On Tue, Aug 24, 2021 at 03:44:48PM -0400, Theodore Ts'o wrote: > On Tue, Aug 24, 2021 at 08:23:15PM +0100, Matthew Wilcox wrote: > > So if someone sees "kmem_cache_alloc()", they can probably make a > guess what it means, and it's memorable once they learn it. > Similarly, something like "head_page", or "mempages" is going to a bit > more obvious to a kernel newbie. So if we can make a tiny gesture > towards comprehensibility, it would be good to do so while it's still > easier to change the name. Talking about being newbie friendly, how about we'll just add a piece of documentation along with the new type for a change? Something along those lines (I'm sure willy can add several more sentences for Folio description) diff --git a/Documentation/vm/memory-model.rst b/Documentation/vm/memory-model.rst index 30e8fbed6914..b5b39ebe67cf 100644 --- a/Documentation/vm/memory-model.rst +++ b/Documentation/vm/memory-model.rst @@ -30,6 +30,29 @@ Each memory model defines :c:func:`pfn_to_page` and :c:func:`page_to_pfn` helpers that allow the conversion from PFN to `struct page` and vice versa. +Pages +----- + +Each physical page frame in the system is represented by a `struct page`. +This structure aggregatates several types, each corresponding to a +particular usage of a page frame, such as anonymous memory, SLAB caches, +file-backed memory etc. These types are define within unions in the struct +page to reduce memory footprint of the memory map. + +The actual type of the particular insance of struct page is determined by +values of the fields shared between the different types and can be quired +using page flag operatoins defined in ``include/linux/page-flags.h`` + +Folios +------ + +For many use cases, single page frame granularity is too small. In such +cases a contiguous range of memory can be referred by `struct folio`. + +A folio is a physically, virtually and logically contiguous range of +bytes. It is a power-of-two in size, and it is aligned to that same +power-of-two. It is at least as large as PAGE_SIZE. + FLATMEM ======= -- Sincerely yours, Mike.