KernelNewbies:

How do we get to memdescs in a series of bisectable, small and reviewable steps?

Immediate projects

There are no dependencies between these projects. They can all be tackled by different people. If you want to work on one of them, please ask Matthew for an invite to the THP Cabal meeting for coordination purposes.

We may wish to do a "developer preview" where we just disable some modules without finishing the completion so that people can evaluate the performance.

After those projects are complete

Then we can shrink struct page to 32 bytes:

struct folio {
    unsigned long flags;
    struct list_head lru;
    struct address_space *mapping;
    pgoff_t index;
    void *private;
    unsigned int _refcount;
    unsigned int _mapcount;
    unsigned int pincount;
    unsigned long pfn;
    struct mem_cgroup *memcg;
};

struct page {
    unsigned long flags;
    union {
        struct list_head buddy_list;
        struct list_head pcp_list;
        struct {
            unsigned long memdesc;
            int _refcount; // 0 for folios
        };
    };
    union {
        unsigned long private;
        struct {
            int _mapcount; // only used for folios?
        };
    };
};

In this 2025 world, we copy page->flags from the first page to the folio, but leave it intact to keep code calling page_zone() working the way it does today.

For a page in a folio, the usage is:

For accounted memory, there are several possibilities:

Notes:

Page2026

The next step is to shrink struct page to 16 bytes,

struct page {
    union {
        struct list_head buddy_list;
        struct {
            unsigned long memdesc;
            unsigned long private;
        };
    };
};

This will involve changes to page_zone(), page_to_nid() and so on.

After this, we can start working on removing accesses to page->private from device drivers. When that is finished, we can explore the various options presented in MatthewWilcox/BuddyAllocator

KernelNewbies: MatthewWilcox/Memdescs/Path (last edited 2024-12-22 20:01:30 by MatthewWilcox)