linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm@linux-foundation.org, rppt@linux.ibm.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 1/3] mm: Factor out the pagetable pages account into new helper function
Date: Fri, 24 Jun 2022 16:41:47 +0800	[thread overview]
Message-ID: <1db60157-9f26-cc09-9a8d-2813a3a3ac95@linux.alibaba.com> (raw)
In-Reply-To: <YrSPsqJHJTRcCmph@casper.infradead.org>



On 6/24/2022 12:07 AM, Matthew Wilcox wrote:
> On Wed, Jun 22, 2022 at 04:58:52PM +0800, Baolin Wang wrote:
>> +static inline void pgtable_set_and_inc(struct page *page)
>> +{
>> +	__SetPageTable(page);
>> +	inc_lruvec_page_state(page, NR_PAGETABLE);
>> +}
> 
> I don't like the names.  The accounting is also wrong for non-order-0
> allocations.  It should be
> 
> 	mod_lruvec_page_state(page, NR_PAGETABLE, compound_nr(page))

Yes, seems need another patch to convert using compound_nr().

> 
> but it's probably better to change the API to pass in the number of
> pages instead of recalculating it.

Lots of callers will not calculate the number of pages, so I think we 
can just add the compound_nr() in the API firstly, which also can avoid 
changing lots of callers.

> I can't think of a good name.  What's wrong with just adding
> 
> static inline bool pgtable_pud_page_ctor(struct page *page)
> 
> to go along with the pte and pmd variants?

IMHO that means we will need another function like 
pgtable_kernel_pte_page_ctor/dtor() to account kernel pagetable, however 
they do the same thing. So a common function which only do 
'__SetPageTable' and account pagetable will be more helpful.

So how about pgtable_page_inc()/pgtable_page_dec()?


  reply	other threads:[~2022-06-24  8:41 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 level pagetable account 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 [this message]
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
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=1db60157-9f26-cc09-9a8d-2813a3a3ac95@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