LWN: Comments on "Clarifying memory management with page folios" https://lwn.net/Articles/849538/ This is a special feed containing comments posted to the individual LWN article titled "Clarifying memory management with page folios". en-us Sun, 14 Sep 2025 09:49:46 +0000 Sun, 14 Sep 2025 09:49:46 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Clarifying memory management with page folios https://lwn.net/Articles/1015495/ https://lwn.net/Articles/1015495/ fest3er <div class="FormattedComment"> Late, but have to add me tuppence, recalling the proverbial bit bucket that sat on the floor next to mainframes of old.<br> <p> 'Bucket-o-bytes', which shortens to 'bob'.<br> <p> And Bob's yer uncle.<br> <p> OK. Maybe not.<br> </div> Wed, 26 Mar 2025 15:42:10 +0000 Clarifying memory management with page folios https://lwn.net/Articles/873114/ https://lwn.net/Articles/873114/ mpr22 <div class="FormattedComment"> Indeed, almost nobody in the Anglosphere is going to think of a word from any of the languages of China when they see &quot;juan&quot;.<br> <p> If anything comes to mind at all, it&#x27;s most likely to be the Spanish form of the Hebrew name יוֹחָנָן‎ (Yôḥānān), equivalent to English John, German Johann, Russian Иван, French Jean, etc.<br> </div> Sat, 16 Oct 2021 10:24:55 +0000 Clarifying memory management with page folios https://lwn.net/Articles/873113/ https://lwn.net/Articles/873113/ hidave <div class="FormattedComment"> Another recommendation maybe not known in English world : juan, it means something like &quot;volume&quot;<br> <a href="https://en.wikipedia.org/wiki/Juan">https://en.wikipedia.org/wiki/Juan</a><br> </div> Sat, 16 Oct 2021 09:05:05 +0000 Clarifying memory management with page folios https://lwn.net/Articles/869350/ https://lwn.net/Articles/869350/ ncm <div class="FormattedComment"> Names need to be long enough to distinguish the thing named from other things it might otherwise have been and (if you exercise any foresight) also things it will not be.<br> <p> How long that name needs to be depends on the scope of the names.<br> <p> In C, lacking any mechanism for namespacing, a practical name *often* must be unpleasantly long. That is a fault of the language, not (usually) of the person choosing the name; although some people confuse names with specifications, and so invent stupidly long names. <br> <p> &quot;Compound_page&quot; is not, in any universe, stupidly long for a C struct tag.<br> </div> Thu, 16 Sep 2021 08:10:08 +0000 Clarifying memory management with page folios https://lwn.net/Articles/868980/ https://lwn.net/Articles/868980/ deepfire <div class="FormattedComment"> Bingo!<br> <p> ..and it&#x27;s surprising how much resistance does this encounter, given the improvements.<br> </div> Sun, 12 Sep 2021 09:37:32 +0000 Clarifying memory management with page folios https://lwn.net/Articles/864966/ https://lwn.net/Articles/864966/ taladar <div class="FormattedComment"> Sounds like folio is basically what Haskell or Rust would call a newtype over page that indicates that certain precondition checks have already been performed.<br> </div> Tue, 03 Aug 2021 08:40:26 +0000 Clarifying memory management with page folios https://lwn.net/Articles/859780/ https://lwn.net/Articles/859780/ DavideRepetto <div class="FormattedComment"> How about &quot;bundle&quot;?<br> <p> </div> Tue, 15 Jun 2021 12:23:23 +0000 Clarifying memory management with page folios https://lwn.net/Articles/851458/ https://lwn.net/Articles/851458/ Hi-Angel <div class="FormattedComment"> <font class="QuotedText">&gt; Honestly, I&#x27;m 120 patches in at this point. Someone&#x27;s going to have to be really convincing to have a better name than folio.</font><br> <p> A little trick: doing a rename over all of the 120 patches might be done in just under a minute ;) What I&#x27;d do here is:<br> <p> ```<br> git format-patch -120 --stdout &gt; 1.patch<br> sp folio my_better_name<br> git am -3 1.patch<br> ```<br> <p> Read `sp` as `sed`.<br> <p> For the sake of completeness: sp is my alias to sed_perl, which in turn is a wrapper over perl to replace text in files <a rel="nofollow" href="https://github.com/Hi-Angel/dotfiles/blob/140c7895150275404b8124484e09d34023b57964/.zshrc#L114-L121">https://github.com/Hi-Angel/dotfiles/blob/140c78951502754...</a> I was at some point annoyed by discrepancies in behavior between grep, sed, awk, and what not, and migrated to using perl + ack (a perl version of grep). Never looked back.<br> <p> So… hopefully this will help.<br> <p> </div> Fri, 02 Apr 2021 11:13:00 +0000 Clarifying memory management with page folios https://lwn.net/Articles/850606/ https://lwn.net/Articles/850606/ flussence <div class="FormattedComment"> 7% is pretty impressive, considering that getting any performance improvement out of the mm code in this day and age is like drawing blood from a stone! <br> <p> I vaguely remember getting excited over the original THP patchset because I&#x27;d measured a consistent 3-4% improvement in memory-heavy workloads…<br> </div> Thu, 25 Mar 2021 23:00:04 +0000 Clarifying memory management with page folios https://lwn.net/Articles/850134/ https://lwn.net/Articles/850134/ milesrout <div class="FormattedComment"> It doesn&#x27;t matter one bit which year it is. This &quot;oh my god it&#x27;s 2021 come on people&quot; attitude is really silly. Long names are inconvenient to read and to write, and encourage code to be split over many lines to fit regardless of how many years it&#x27;s been since Jesus was born.<br> </div> Mon, 22 Mar 2021 23:48:17 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849974/ https://lwn.net/Articles/849974/ kiryl <div class="FormattedComment"> It is not a compound page, but rather a head of compound page or a non-compound page. Compound page would be totally misleading.<br> </div> Sun, 21 Mar 2021 20:38:58 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849877/ https://lwn.net/Articles/849877/ clugstj <div class="FormattedComment"> Well then, I must respectfully disagree. IMO, the obvious name should not be ignored because it is &quot;too long&quot;. This is not the 1960s, we can afford clarity of naming in code.<br> </div> Fri, 19 Mar 2021 17:16:55 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849875/ https://lwn.net/Articles/849875/ willy <div class="FormattedComment"> Because that&#x27;s an extra 9 characters over &#x27;struct page&#x27;. Short is generally better for something that&#x27;s common.<br> </div> Fri, 19 Mar 2021 17:02:39 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849874/ https://lwn.net/Articles/849874/ clugstj <div class="FormattedComment"> Why not? <br> </div> Fri, 19 Mar 2021 17:01:11 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849873/ https://lwn.net/Articles/849873/ willy <div class="FormattedComment"> Are you suggesting calling it &#x27;struct compound_page&#x27;?<br> </div> Fri, 19 Mar 2021 16:57:20 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849848/ https://lwn.net/Articles/849848/ clugstj <div class="FormattedComment"> I&#x27;m confused. It&#x27;s a compound page, why not call it compound_page?<br> </div> Fri, 19 Mar 2021 14:08:01 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849826/ https://lwn.net/Articles/849826/ willy <div class="FormattedComment"> Have you looked at the patch series? I don&#x27;t do everything in one go. Essentially I&#x27;m going one function at a time. It&#x27;s pretty straightforward to convert between pages and folios. If you have a page and want the folio that contains it, that&#x27;s spelled page_folio(page). If you have a folio and want the head page, that&#x27;s &amp;folio-&gt;page. If you have a folio and want the page that corresponds to a particular file index, that&#x27;s folio_file_page(folio, index).<br> <p> If you have a folio and want the n&#x27;th page, that&#x27;s nth_page(&amp;folio-&gt;page, n). Nobody&#x27;s needed that one yet (and only people with really weird physical memory layouts need to do that ... alloc_folio() won&#x27;t return a folio that you need to do that to. Others are working on maybe disallowing those from existing entirely, in which case (&amp;folio-&gt;page + n) will do fine.<br> <p> 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&#x27;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.<br> <p> I think what you&#x27;re suggesting is essentially what I did here:<br> <a href="https://git.infradead.org/users/willy/pagecache.git/shortlog/refs/tags/thp-5.10-rc1">https://git.infradead.org/users/willy/pagecache.git/short...</a><br> <p> I&#x27;ve given up on that approach because it&#x27;s hard to find all the bugs. &quot;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?&quot; I invite you to consider the various implementations of flush_dcache_page() ... and if you can figure out the answer, please let me know.<br> <p> </div> Fri, 19 Mar 2021 11:29:05 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849827/ https://lwn.net/Articles/849827/ geert <div class="FormattedComment"> Thanks, folio is fine! ;-)<br> </div> Fri, 19 Mar 2021 11:17:44 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849825/ https://lwn.net/Articles/849825/ willy <div class="FormattedComment"> Aigle is a French paper size: <a href="https://en.wikipedia.org/wiki/Paper_size">https://en.wikipedia.org/wiki/Paper_size</a><br> <p> <a href="https://en.wikipedia.org/wiki/Units_of_paper_quantity">https://en.wikipedia.org/wiki/Units_of_paper_quantity</a> is also a good source of names.<br> <p> Honestly, I&#x27;m 120 patches in at this point. Someone&#x27;s going to have to be really convincing to have a better name than folio.<br> <p> </div> Fri, 19 Mar 2021 11:10:42 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849823/ https://lwn.net/Articles/849823/ geert <div class="FormattedComment"> As a non-native English speaker, I had to look up most of the rejected options, so IMHO they must be fairly obscure...<br> <p> BTW, &quot;aigle&quot; is not known by &quot;dict&quot;, nor by my paper dictionary.<br> </div> Fri, 19 Mar 2021 09:32:09 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849821/ https://lwn.net/Articles/849821/ wahern <div class="FormattedComment"> Rather than doing everything in one go, couldn&#x27;t a transparent union argument type and _Generic be used, variously, for certain critical functions and highly-trafficked interfaces? I image much of the performance improvements come from a relatively small subset of the changes. Those could be nailed down in a smaller patch series, and the remainder fixed over time.<br> <p> </div> Fri, 19 Mar 2021 09:12:35 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849807/ https://lwn.net/Articles/849807/ jonas.bonn <div class="FormattedComment"> I like the name folio, but as a North American it&#x27;s just got Shakespeare written all over it and has little intrinsic meaning; I understand where the reluctance towards the name is coming from...<br> <p> Normally, pages are created by folding a &#x27;sheet&#x27;... so there you go!<br> <p> <a href="https://en.wikipedia.org/wiki/Paper_size#/media/File:A_size_illustration2.svg">https://en.wikipedia.org/wiki/Paper_size#/media/File:A_si...</a><br> </div> Fri, 19 Mar 2021 04:38:39 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849806/ https://lwn.net/Articles/849806/ willy <div class="FormattedComment"> New version of patch series:<br> <p> <a href="https://git.infradead.org/users/willy/pagecache.git/shortlog/refs/heads/folio">https://git.infradead.org/users/willy/pagecache.git/short...</a><br> <p> I&#x27;ll do the changelog / cover letter / ... in the morning.<br> <p> <p> 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.<br> <p> </div> Fri, 19 Mar 2021 04:10:07 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849805/ https://lwn.net/Articles/849805/ guillemj <div class="FormattedComment"> Ah, that brought up old memories of viengoos (<a href="https://git.savannah.gnu.org/gitweb/?p=hurd/viengoos.git;a=blob;f=libviengoos/viengoos/folio.h;hb=HEAD">https://git.savannah.gnu.org/gitweb/?p=hurd/viengoos.git;...</a>).<br> </div> Fri, 19 Mar 2021 03:21:52 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849804/ https://lwn.net/Articles/849804/ willy <div class="FormattedComment"> I threw out a bunch of options early on: ream, sheaf and album didn&#x27;t make it. Nor did quarto, aigle, quire, leaf, octavo or any number of other options ;-)<br> <p> <a href="https://lore.kernel.org/linux-fsdevel/20201113174409.GH17076@casper.infradead.org/">https://lore.kernel.org/linux-fsdevel/20201113174409.GH17...</a><br> <p> Criteria: Must be easily greppable (book is bad), must be short, shouldn&#x27;t be too cutesy (banqyet by analogy with byte was not under consideration).<br> <p> Online thesauri are your friends, but at the end of the day it&#x27;s always a matter of taste.<br> <p> </div> Fri, 19 Mar 2021 03:17:03 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849785/ https://lwn.net/Articles/849785/ unixbhaskar <div class="FormattedComment"> Okay, I have had the uncanny habit of touching the triviality and it reflects on my work ...anyway...this point in the article :<br> <p> &quot;One should also bear in mind that there is an inevitable discussion on naming to be had; it is already clear that &quot;folio&quot; is not popular, though alternatives are currently thin on the ground. One conclusion is thus clear: the kernel may well get folios or something like them, but it seems unlikely to happen soon.&quot;<br> <p> Matthew and Jon, how about a simple name(well, kernel is a bloody complex thing, it doesn&#x27;t mean, it has to have a complex or artistic name,does it?) like &quot;page_access&quot; ? (I am sure that I missed certain things, a plethora of kernel API/ABI should have checked before preaching ...:) , which I haven&#x27;t done so. But ......<br> <p> Stop fretting at my naivety .... :) ..please...<br> </div> Thu, 18 Mar 2021 21:47:47 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849779/ https://lwn.net/Articles/849779/ mathstuf <div class="FormattedComment"> I like &quot;ream&quot; personally. Not sure if that&#x27;s come up in the discussion already.<br> </div> Thu, 18 Mar 2021 20:14:22 +0000 Clarifying memory management with page folios https://lwn.net/Articles/849767/ https://lwn.net/Articles/849767/ logang <div class="FormattedComment"> I thought the folio name was rather clever as the definition is a great fit. But maybe clever isn&#x27;t always a good thing.<br> <p> In any case, if it gets in as named, it&#x27;s only a matter of time before we can start describing compound pages as foliolate (having compound leaves) and someone is sure to come up with a case for a &#x27;struct portfolio&#x27;. ;-)<br> </div> Thu, 18 Mar 2021 17:24:45 +0000