From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Matthew Wilcox <willy@infradead.org>, Mike Rapoport <rppt@linux.ibm.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/3] mm: Add PUD level pagetable account
Date: Fri, 24 Jun 2022 16:52:34 +0800 [thread overview]
Message-ID: <ed072ac6-cc70-9070-4e9d-281b9b60c9a6@linux.alibaba.com> (raw)
In-Reply-To: <YrRqhj3p/KKU73f1@casper.infradead.org>
On 6/23/2022 9:28 PM, Matthew Wilcox wrote:
> 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.
Yes. Thanks.
>
>>> + 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.
IMO I have no strong preference. The code can be simpler with using
__get_free_pages(), however like Matthew said it will add more conversion.
next prev parent reply other threads:[~2022-06-24 8:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 8:58 [RFC PATCH v2 0/3] Add PUD and kernel PTE " Baolin Wang
2022-06-22 8:58 ` [RFC PATCH v2 1/3] mm: Factor out the pagetable pages account into new helper function Baolin Wang
2022-06-23 16:07 ` Matthew Wilcox
2022-06-24 8:41 ` Baolin Wang
2022-06-22 8:58 ` [RFC PATCH v2 2/3] mm: Add PUD level pagetable account Baolin Wang
2022-06-22 14:38 ` Mike Rapoport
2022-06-23 3:32 ` Baolin Wang
2022-06-23 13:28 ` Matthew Wilcox
2022-06-24 8:52 ` Baolin Wang [this message]
2022-06-22 8:58 ` [RFC PATCH v2 3/3] mm: Add kernel PTE level pagetable pages account Baolin Wang
2022-06-22 14:44 ` Mike Rapoport
2022-06-23 3:34 ` Baolin Wang
2022-07-12 6:08 ` [mm] 0bf5cdf08f: BUG:Bad_page_state_in_process kernel test robot
2022-07-13 9:17 ` Baolin Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ed072ac6-cc70-9070-4e9d-281b9b60c9a6@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@linux.ibm.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®