Re: State of the Page (August 2022)
From: Mike Rapoport
Date: Sat Aug 13 2022 - 11:21:35 EST
Hi,
On Thu, Aug 11, 2022 at 10:31:21PM +0100, Matthew Wilcox wrote:
> ==============================
> State Of The Page, August 2022
> ==============================
>
> I thought I'd write down where we are with struct page and where
> we're going, just to make sure we're all (still?) pulling in a similar
> direction.
>
> Destination
> ===========
>
> For some users, the size of struct page is simply too large. At 64
> bytes per 4KiB page, memmap occupies 1.6% of memory. If we can get
> struct page down to an 8 byte tagged pointer, it will be 0.2% of memory,
> which is an acceptable overhead.
>
> struct page {
> unsigned long mem_desc;
> };
This is 0.2% for a system that does not have any actual memdescs.
Do you have an estimate how much memory will be used by the memdescs, at
least for some use-cases?
Another thing, we are very strict about keeping struct page at its current
size. Don't you think it will be much more tempting to grow either of
memdescs and for some use cases the overhead will be at least as big as
now?
> Types of memdesc
> ----------------
>
> This is very much subject to change as new users present themselves.
> Here are the current ones in-plan:
>
> - Undescribed. Instead of the rest of the word being a pointer,
> there are 2^28 subtypes available:
> - Unmappable. Typically device drivers allocating private memory.
> - Reserved. These pages are not allocatable.
> - HWPoison
> - Offline (eg balloon)
> - Guard (see debug_pagealloc)
> - Slab
> - Anon Folio
> - File Folio
> - Buddy (ie free -- also for PCP?)
> - Page Table
> - Vmalloc
> - Net Pool
> - Zsmalloc
> - Z3Fold
> - Mappable. Typically device drivers mapping memory to userspace
>
> That implies 4 bits needed for the tag, so all memdesc allocations
> must be 16-byte aligned. That is not an undue burden. Memdescs
> must also be TYPESAFE_BY_RCU if they are mappable to userspace or
> can be stored in a file's address_space.
>
> It may be worth distinguishing between vmalloc-mappable and
> vmalloc-unmappable to prevent some things being mapped to userspace
> inadvertently.
--
Sincerely yours,
Mike.