Clarifying memory management with page folios
Clarifying memory management with page folios
Posted Mar 19, 2021 4:10 UTC (Fri) by willy (subscriber, #9762)Parent article: Clarifying memory management with page folios
https://git.infradead.org/users/willy/pagecache.git/short...
I'll do the changelog / cover letter / ... in the morning.
BTW, I do want to emphasize that real workloads see a performance improvement. With the previous work, based on using Transparent Huge Pages, we saw a 7% performance improvement on kernel compiles, and that was with a very naive untuned algorithm for scaling up the THP size.
Posted Mar 19, 2021 9:12 UTC (Fri)
by wahern (subscriber, #37304)
[Link] (1 responses)
Posted Mar 19, 2021 11:29 UTC (Fri)
by willy (subscriber, #9762)
[Link]
If you have a folio and want the n'th page, that's nth_page(&folio->page, n). Nobody's needed that one yet (and only people with really weird physical memory layouts need to do that ... alloc_folio() won't return a folio that you need to do that to. Others are working on maybe disallowing those from existing entirely, in which case (&folio->page + n) will do fine.
The performance improvements do not come from a small subset of the changes. You have to make the entire filesystem safe to handle memory in folios (no more references to, eg, PAGE_SIZE, unless you can prove they're safe, calls to kmap() have to be scrutinised. copy_(to|from)_iter() calls need care and attention, etc, etc). Once the filesystem declares itself safe by setting a bit in the fs_flags then the page cache can start handing it folios instead of pages.
I think what you're suggesting is essentially what I did here:
I've given up on that approach because it's hard to find all the bugs. "Oh this interface takes a struct page. Does it take any struct page, or do I need to call it once for each tail page in the compound page?" I invite you to consider the various implementations of flush_dcache_page() ... and if you can figure out the answer, please let me know.
Posted Mar 25, 2021 23:00 UTC (Thu)
by flussence (guest, #85566)
[Link]
I vaguely remember getting excited over the original THP patchset because I'd measured a consistent 3-4% improvement in memory-heavy workloads…
Clarifying memory management with page folios
Clarifying memory management with page folios
https://git.infradead.org/users/willy/pagecache.git/short...
Clarifying memory management with page folios