Re: [RFC PATCH 01/16] mm: add pagechain container for storing multiple pages.
From: Matthew Wilcox
Date: Wed Sep 02 2020 - 23:16:08 EST
On Wed, Sep 02, 2020 at 02:06:13PM -0400, Zi Yan wrote:
> When depositing page table pages for 1GB THPs, we need 512 PTE pages +
> 1 PMD page. Instead of counting and depositing 513 pages, we can use the
> PMD page as a leader page and chain the rest 512 PTE pages with ->lru.
> This, however, prevents us depositing PMD pages with ->lru, which is
> currently used by depositing PTE pages for 2MB THPs. So add a new
> pagechain container for PMD pages.
But you've allocated a page for the PMD table. Why can't you use that
4kB to store pointers to the 512 PTE tables?
You could also use an existing data structure like the XArray (although
not a pagevec).