Memory Folios Updated A 14th Time For Improving Linux Memory Management
Matthew Wilcox of Oracle has sent out his 14th revision to the memory "folios" patch-set for this new struct that aims to improve Linux's memory management code and ultimately better performance.
Memory folios is the work that can allow for better system performance like ~7% faster kernel builds as one beneficial metric. For those missing out on the earlier articles on Linux's memory folios, Wilcox sums it up as:
With memory folios v14 the code is re-based against Linux 5.14-rc1 and there are a variety of low-level code fixes, renaming of various functions, and other mostly smaller changes at this stage to improve the code formatting and structure.
There is a call to see at least some of memory folios for Linux 5.15 so we'll see if that happens. Given the possible performance wins, I'll also be firing up some kernel benchmarks with memory folios shortly.
Memory folios is the work that can allow for better system performance like ~7% faster kernel builds as one beneficial metric. For those missing out on the earlier articles on Linux's memory folios, Wilcox sums it up as:
Managing memory in 4KiB pages is a serious overhead. Many benchmarks benefit from a larger "page size". As an example, an earlier iteration of this idea which used compound pages (and wasn't particularly tuned) got a 7% performance boost when compiling the kernel.
Using compound pages or THPs exposes a weakness of our type system. Functions are often unprepared for compound pages to be passed to them, and may only act on PAGE_SIZE chunks. Even functions which are aware of compound pages may expect a head page, and do the wrong thing if passed a tail page.
We also waste a lot of instructions ensuring that we're not looking at a tail page. Almost every call to PageFoo() contains one or more hidden calls to compound_head(). This also happens for get_page(), put_page() and many more functions.
This patch series uses a new type, the struct folio, to manage memory. It converts enough of the page cache, iomap and XFS to use folios instead of pages, and then adds support for multi-page folios. It passes xfstests (running on XFS) with no regressions compared to v5.14-rc1.
With memory folios v14 the code is re-based against Linux 5.14-rc1 and there are a variety of low-level code fixes, renaming of various functions, and other mostly smaller changes at this stage to improve the code formatting and structure.
There is a call to see at least some of memory folios for Linux 5.15 so we'll see if that happens. Given the possible performance wins, I'll also be firing up some kernel benchmarks with memory folios shortly.
12 Comments