[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YrRqhj3p/KKU73f1@casper.infradead.org>
Date: Thu, 23 Jun 2022 14:28:38 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Mike Rapoport <rppt@...ux.ibm.com>
Cc: Baolin Wang <baolin.wang@...ux.alibaba.com>,
akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2 2/3] mm: Add PUD level pagetable account
On Wed, Jun 22, 2022 at 09:38:30AM -0500, Mike Rapoport wrote:
> On Wed, Jun 22, 2022 at 04:58:53PM +0800, Baolin Wang wrote:
> > +++ b/arch/loongarch/include/asm/pgalloc.h
> > @@ -89,10 +89,15 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
> > static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
> > {
> > pud_t *pud;
> > + struct page *pg;
>
> struct page *page;
>
> looks better IMO.
>
> > +
> > + pg = alloc_pages(GFP_KERNEL & ~__GFP_HIGHMEM, PUD_ORDER);
GFP_KERNEL does not include __GFP_HIGHMEM, so you can just use
GFP_KERNEL here.
> > + if (!pg)
> > + return NULL;
> >
> > - pud = (pud_t *) __get_free_pages(GFP_KERNEL, PUD_ORDER);
> > - if (pud)
> > - pud_init((unsigned long)pud, (unsigned long)invalid_pmd_table);
> > + pgtable_set_and_inc(pg);
> > + pud = (pud_t *)page_address(pg);
>
> I don't think __get_free_pages() should be replaced with alloc_pages()
> here, just call pgtable_set_and_inc() with virt_to_page(pud).
I don't understand why you want that. Take a look at the implementation
of __get_free_pages(). Converting back to a struct page after calling
that seems like a real waste of time to me.
Powered by blists - more mailing lists