mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Qi Zheng <qi.zheng@linux.dev>, <muchun.song@linux.dev>,
	<osalvador@suse.de>, <david@kernel.org>,
	<akpm@linux-foundation.org>, <azpijr@gmail.com>,
	<lance.yang@linux.dev>, Qi Zheng <zhengqi.arch@bytedance.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	<stable@vger.kernel.org>,
	"Oscar Salvador (SUSE)" <osalvador@kernel.org>
Subject: Re: [PATCH v4 3/3] mm: hugetlb: fix GFP mask propagation to CMA
Date: Fri, 13 Nov 2026 11:56:33 +0800	[thread overview]
Message-ID: <9b46d8e0-104e-4659-8dec-67eb6f059dac@huawei.com> (raw)
In-Reply-To: <1cd3c151-24c2-4fec-8356-99853f8d6971@linux.dev>



On 11/13/2026 10:30 AM, Qi Zheng wrote:
> 
> 
> On 11/12/26 7:27 PM, Kefeng Wang wrote:
>>
>>
>> On 11/11/2026 2:46 PM, Qi Zheng wrote:
>>> From: Qi Zheng <zhengqi.arch@bytedance.com>
>>>
>>> cma_alloc_frozen_compound() uses GFP_KERNEL, allowing direct reclaim
>>> during the first MPOL_PREFERRED_MANY allocation attempt even though
>>> the caller clears __GFP_DIRECT_RECLAIM.
>>
>> MPOL_PREFERRED_MANY is only used for the partner allocator. Without your
> 
> It's doesn't seem so.
> 
> Gigantic surplus allocations already use MPOL_PREFERRED_MANY, following
> eb02f14c4a2b ("mm/hugetlb: allow overcommitting gigantic hugepages"),
> which predates 9bda131c6093.
> 
> alloc_buddy_hugetlb_folio
> --> MPOL_PREFERRED_MANY
>      --> gfp_t gfp = gfp_mask & ~(__GFP_DIRECT_RECLAIM | __GFP_NOFAIL);
>          folio = alloc_surplus_hugetlb_folio(h, gfp, mpoli->nid, nodemask);
>          --> alloc_fresh_hugetlb_folio
>              --> only_alloc_fresh_hugetlb_folio
>                  --> alloc_gigantic_frozen_folio
>                      --> hugetlb_cma_alloc_frozen_folio
>                          --> cma_alloc_frozen_compound
> 
> Before 9bda131c6093, cma_alloc_folio() forwarded the caller's GFP mask.
> The conversion to cma_alloc_frozen_compound() replaced it with
> GFP_KERNEL, re-enabling direct reclaim during the preferred-node
> attempt.

Oh, I forgot about that commit. The naming and some of the comments are 
misleading because alloc_buddy_hugetlb_folio/alloc_surplus_hugetlb_folio
can allocate both buddy and gigantic folios (which can be allocated from
CMA).

Maybe rename alloc_buddy_hugetlb_folio to hugetlb_alloc_surplus_folio,
or other names...

      reply	other threads:[~2026-11-13  3:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  6:46 [PATCH v4 0/3] mm: hugetlb: fix CMA-related issues Qi Zheng
2026-11-11  6:46 ` [PATCH v4 1/3] x86: hugetlb: disable default CMA reservations on 32-bit kernel Qi Zheng
2026-11-11  6:46 ` [PATCH v4 2/3] mm: gup: allow long-term pins of CMA-allocated HugeTLB folios Qi Zheng
2026-11-11  7:42   ` David Hildenbrand (Arm)
2026-11-11  7:42   ` Muchun Song
2026-11-12  6:13     ` Qi Zheng
2026-11-12  8:49       ` David Hildenbrand (Arm)
2026-11-12  9:04         ` Qi Zheng
2026-11-11  6:46 ` [PATCH v4 3/3] mm: hugetlb: fix GFP mask propagation to CMA Qi Zheng
2026-11-12 11:27   ` Kefeng Wang
2026-11-12 11:30     ` Kefeng Wang
2026-11-13  2:30     ` Qi Zheng
2026-11-13  3:56       ` Kefeng Wang [this message]

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=9b46d8e0-104e-4659-8dec-67eb6f059dac@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=azpijr@gmail.com \
    --cc=david@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@kernel.org \
    --cc=osalvador@suse.de \
    --cc=qi.zheng@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=zhengqi.arch@bytedance.com \
    /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®