linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Baolin Wang <baolin.wang@linux.alibaba.com>, akpm@linux-foundation.org
Cc: mgorman@techsingularity.net, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: page_alloc: use the correct THP order for THP PCP
Date: Thu, 4 Apr 2024 16:01:18 +0200	[thread overview]
Message-ID: <0cbd9644-5900-4f02-adf8-d3f1182d399b@suse.cz> (raw)
In-Reply-To: <30bef3d6-3381-491e-a00a-bd1fb7e8d8f8@linux.alibaba.com>

On 4/4/24 2:19 PM, Baolin Wang wrote:
> 
> 
> On 2024/4/4 18:03, Vlastimil Babka wrote:
>> On 4/3/24 3:47 PM, Baolin Wang wrote:
>>> Commit 44042b449872 ("mm/page_alloc: allow high-order pages to be stored
>>> on the per-cpu lists") extends the PCP allocator to store THP pages, and
>>> it determines whether to cache THP pags in PCP by comparing with pageblock_order.
>>> But the pageblock_order is not always equal to THP order, it might also
>>> be MAX_PAGE_ORDER, which could prevent PCP from caching THP pages.
>>>
>>> Therefore, using HPAGE_PMD_ORDER instead to determine the need for caching
>>> THP for PCP can fix this issue
>>>
>>> Fixes: 44042b449872 ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists")
>>> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
>> 
>> IIUC this happens with CONFIG_HUGETLB_PAGE disabled because HUGETLBFS is
>> disabled? But THPs are still enabled? I think there might be more of THP
> 
> Right, and seems the Powerpc arch will set pageblock_order via 
> set_pageblock_order() when the huge page sizes are variable (not sure if 
> this is always equal to THP order).
> 
> Moreover, it still does not make sense to use pageblock_order to 
> indicate a THP page, especially when we already have HPAGE_PMD_ORDER to 
> represent THP.
> 
>> working suboptimally in that case with pageblock_order being larger
>> (MAX_PAGE_ORDER).
>> 
>> In other words, should be rather make pageblock_order itself defined as
>> 
>>   min_t(unsigned int, HPAGE_PMD_ORDER, MAX_PAGE_ORDER)
>> 
>> in case with !CONFIG_HUGETLB_PAGE but THP enabled.
> 
> Yes, this makes sense to me (I wonder why this wasn't done before?). I 
> can create a seperate patch to do this, what do you think? Thanks.

It probably wasn't anticipated that hugetlbfs would be disabled and THP
enabled. If you can create such patch, great!


  reply	other threads:[~2024-04-04 14:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 13:47 Baolin Wang
2024-04-04 10:03 ` Vlastimil Babka
2024-04-04 12:19   ` Baolin Wang
2024-04-04 14:01     ` Vlastimil Babka [this message]
2024-04-04 14:00 ` Vlastimil Babka
2024-04-05  4:53 ` Barry Song
2024-04-05 12:16   ` 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=0cbd9644-5900-4f02-adf8-d3f1182d399b@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    /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