On Mon, Jul 10, 2023 at 05:21:04PM -0700, Luis Chamberlain wrote: > On Tue, Jul 11, 2023 at 01:07:37AM +0100, Matthew Wilcox wrote: > > The caller hints at the > > folio size it wants, and this code you're highlighting limits it to be > > less than MAX_PAGECACHE_ORDER. > > Yes sorry, if the write size is large we still max out at MAX_PAGECACHE_ORDER > naturally. I don't doubt the rationale that that is a good idea. > > What I'm curious about is why are we OK to jump straight to MAX_PAGECACHE_ORDER > from the start and if there are situations where perhaps a a > not-so-aggressive high order may be desriable. How do we know? The page cache trusts the filesystem to make a good guess. Dave had some ideas about how XFS might make different guesses from the one in this patchset, and I encourage people to experiment with different algorithms. Intuitively "size of the write" is probably not a bad guess. If userspace is writing 400kB in a single write, it proabbly makes sense to writeback & age and eventually reclaim that entire 400kB at the same time. If we guess wrong, the downside probably isn't too bad either. But we need data! And merging this patch set & gathering real world experience with it is a good start.