Re: [PATCH 1/7] mm: Document x86 uses a linked list of pgds
From: Matthew Wilcox
Date: Tue Apr 28 2020 - 18:52:57 EST
On Tue, Apr 28, 2020 at 02:41:09PM -0700, Ira Weiny wrote:
> On Tue, Apr 28, 2020 at 12:44:43PM -0700, Matthew Wilcox wrote:
> > x86 uses page->lru of the pages used for pgds, but that's not immediately
> > obvious to anyone looking to make changes. Add a struct list_head to
> > the union so it's clearly in use for pgds.
>
> Shouldn't pgd_list_{add,del}() use this list head variable instead of lru to
> complete the documentation?
>
> Probably the list iteration loops arch/x86/* as well?
Yes, but I felt that was out of scope for this patchset. Untangling the
uses of struct page is a long and messy business; if we have to fix
everything at once, we'll never get anywhere. There's also the slab
users of page->lru instead of page->slab_list.
What I actually want to get to is:
struct page {
unsigned long flags;
union {
struct file_page file;
struct anon_page anon;
struct pt_page pt;
struct slab_page slab;
struct tail_page tail;
struct rcu_head rcu;
};
union {
atomic_t _mapcount;
...
};
atomic_t refcount;
...
};
and then we can refer to page->pt.list and so on.