Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/readahead: make space in struct file_ra_state

We need to be able to store the preferred folio order associated with a
readahead request in the struct file_ra_state so that we can more
accurately increase the order across subsequent readahead requests. But
struct file_ra_state is per-struct file, so we don't really want to
increase it's size.

mmap_miss is currently 32 bits but it is only counted up to 10 *
MMAP_LOTSAMISS, which is currently defined as 1000. So 16 bits should be
plenty. Redefine it to unsigned short, making room for order as unsigned
short in follow up commit.

Link: https://lkml.kernel.org/r/20250609092729.274960-4-ryan.roberts@arm.com
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Ryan Roberts and committed by
Andrew Morton
f5e8b140 18ebe55a

+7 -6
+1 -1
include/linux/fs.h
··· 1054 1054 unsigned int size; 1055 1055 unsigned int async_size; 1056 1056 unsigned int ra_pages; 1057 - unsigned int mmap_miss; 1057 + unsigned short mmap_miss; 1058 1058 loff_t prev_pos; 1059 1059 }; 1060 1060
+6 -5
mm/filemap.c
··· 3217 3217 DEFINE_READAHEAD(ractl, file, ra, mapping, vmf->pgoff); 3218 3218 struct file *fpin = NULL; 3219 3219 unsigned long vm_flags = vmf->vma->vm_flags; 3220 - unsigned int mmap_miss; 3220 + unsigned short mmap_miss; 3221 3221 3222 3222 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 3223 3223 /* Use the readahead code, even if readahead is disabled */ ··· 3285 3285 struct file_ra_state *ra = &file->f_ra; 3286 3286 DEFINE_READAHEAD(ractl, file, ra, file->f_mapping, vmf->pgoff); 3287 3287 struct file *fpin = NULL; 3288 - unsigned int mmap_miss; 3288 + unsigned short mmap_miss; 3289 3289 3290 3290 /* If we don't want any read-ahead, don't bother */ 3291 3291 if (vmf->vma->vm_flags & VM_RAND_READ || !ra->ra_pages) ··· 3605 3605 static vm_fault_t filemap_map_folio_range(struct vm_fault *vmf, 3606 3606 struct folio *folio, unsigned long start, 3607 3607 unsigned long addr, unsigned int nr_pages, 3608 - unsigned long *rss, unsigned int *mmap_miss) 3608 + unsigned long *rss, unsigned short *mmap_miss) 3609 3609 { 3610 3610 vm_fault_t ret = 0; 3611 3611 struct page *page = folio_page(folio, start); ··· 3667 3667 3668 3668 static vm_fault_t filemap_map_order0_folio(struct vm_fault *vmf, 3669 3669 struct folio *folio, unsigned long addr, 3670 - unsigned long *rss, unsigned int *mmap_miss) 3670 + unsigned long *rss, unsigned short *mmap_miss) 3671 3671 { 3672 3672 vm_fault_t ret = 0; 3673 3673 struct page *page = &folio->page; ··· 3709 3709 struct folio *folio; 3710 3710 vm_fault_t ret = 0; 3711 3711 unsigned long rss = 0; 3712 - unsigned int nr_pages = 0, mmap_miss = 0, mmap_miss_saved, folio_type; 3712 + unsigned int nr_pages = 0, folio_type; 3713 + unsigned short mmap_miss = 0, mmap_miss_saved; 3713 3714 3714 3715 rcu_read_lock(); 3715 3716 folio = next_uptodate_folio(&xas, mapping, end_pgoff);