Skip to contentSkip to conversation

mm/readahead: add a desired folio order for readhead

PATCH In review Jaegeuk Kim 2 participants 3 messages Nov 21, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/readahead: add a desired folio order for readhead

This patch adds a desired folio order in file_ra_state in order to get non-zero-order allocation for readahead.

Cc David Hildenbrand <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
---
 include/linux/fs.h | 1 +
 mm/filemap.c       | 2 +-
 mm/readahead.c     | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
include/linux/fs.h +1 -0
index c895146c1444..8233b166139b 100644
@@ -1167,6 +1167,7 @@ struct file_ra_state {
 	unsigned int async_size;
 	unsigned int ra_pages;
 	unsigned short order;
+	unsigned short desired_order;
 	unsigned short mmap_miss;
 	loff_t prev_pos;
 };
mm/filemap.c +1 -1
index 13f0259d993c..6aa0e26c5d17 100644
@@ -3332,7 +3332,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)
 		ra->start = max_t(long, 0, vmf->pgoff - ra->ra_pages / 2);
 		ra->size = ra->ra_pages;
 		ra->async_size = ra->ra_pages / 4;
-		ra->order = 0;
+		ra->order = ra->desired_order;
 	}
 
 	fpin = maybe_unlock_mmap_for_io(vmf, fpin);
mm/readahead.c +1 -1
index 3a4b5d58eeb6..5194211dfdee 100644
@@ -621,7 +621,7 @@ void page_cache_sync_ra(struct readahead_control *ractl,
 	ra->size = min(contig_count + req_count, max_pages);
 	ra->async_size = 1;
 readit:
-	ra->order = 0;
+	ra->order = ra->desired_order;
 	ractl->_index = ra->start;
 	page_cache_ra_order(ractl, ra);
 }
Signature · 1 line
2.52.0.487.g5c8c507ade-goog
maintainer
#1 lore raw
Quoted 2 lines · Jaegeuk Kim

This patch adds a desired folio order in file_ra_state in order to get non-zero-order allocation for readahead.

Why? Does it not ramp up quickly enough for you?

I see a lot of patches from you that say what the patch does but very little about why. Please explain yourself more.

#2 lore raw
Quoted 8 lines · Matthew Wilcox
Quoted 2 lines · Jaegeuk Kim

This patch adds a desired folio order in file_ra_state in order to get non-zero-order allocation for readahead.

Why? Does it not ramp up quickly enough for you?

I see a lot of patches from you that say what the patch does but very little about why. Please explain yourself more.

Yeah, let me revisit the patches and post another version that uplifts code into mm/fs with what I'm trying to address.