linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	20250910133958.301467-1-wangkefeng.wang@huawei.com,
	Andrew Morton <akpm@linux-foundation.org>,
	Oscar Salvador <osalvador@suse.de>,
	Muchun Song <muchun.song@linux.dev>, Zi Yan <ziy@nvidia.com>,
	Matthew Wilcox <willy@infradead.org>
Cc: sidhartha.kumar@oracle.com, jane.chu@oracle.com,
	Vlastimil Babka <vbabka@suse.cz>,
	Brendan Jackman <jackmanb@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH 4/4] mm: hugetlb: allocate frozen pages in alloc_gigantic_folio()
Date: Thu, 11 Sep 2025 20:56:50 +0200	[thread overview]
Message-ID: <667133bd-0021-4d4e-9cde-fc8c1324522a@redhat.com> (raw)
In-Reply-To: <8508e8fb-77cc-43a7-8460-456f68a552ba@huawei.com>

On 11.09.25 11:11, Kefeng Wang wrote:
> 
> 
> On 2025/9/11 16:25, David Hildenbrand wrote:
>> On 11.09.25 08:56, Kefeng Wang wrote:
>>> The alloc_gigantic_folio() allocates a folio by alloc_contig_range()
>>> with refcount increated and then freeze it, convert to allocate a frozen
>>> folio directly to remove the atomic operation about folio refcount, also
>>> saving atomic operation during __update_and_free_hugetlb_folio too.
>>>
>>> Rename some functions to make them more self-explanatory,
>>>
>>>     folio_alloc_gigantic            -> folio_alloc_frozen_gigantic
>>>     cma_{alloc,free}_folio          -> cma_{alloc,free}_frozen_folio
>>>     hugetlb_cma_{alloc,free}_folio  -> hugetlb_cma_{alloc,free}
>>> _frozen_folio
>>
>> Can we just get rid of folio_alloc_frozen_gigantic?
>>
> 
> OK, we could kill it.
> 
>> Further, can we just get rid of cma_{alloc,free}_frozen_folio() as well
>> and just let hugetlb use alloc_contig_range_frozen() etc?
> 
> HugeTLB can allocate folio by alloc_contig_frozen_pages() directly, but
> it could allocate from hugetlb_cma, cma_alloc_folio() need change some
> cma metadata, so we need to keep it.

Hm. Assuming we just have cma_alloc_frozen() -- again, probably what 
cma_alloc() would look like in the future, hugetlb can just construct a 
folio out of that.

Maybe we just want a helper to create a folio out of a given page range?

And that page range is either obtained through cma_alloc_frozen() or 
alloc_contig_frozen_pages().

Just a thought, keeping in mind that these things should probably just 
work with frozen pages and let allcoating of a memdesc etc. be taken 
care of someone else.

I'd be happy if we can remove the GFP_COMPOUND parameter from alloc_contig*.

@Willy, what's your take?

-- 
Cheers

David / dhildenb



  reply	other threads:[~2025-09-11 18:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11  6:56 [PATCH 0/4] mm: hugetlb: allocate frozen gigantic folio Kefeng Wang
2025-09-11  6:56 ` [PATCH 1/4] mm: debug_vm_pgtable: add debug_vm_pgtable_free_huge_page() Kefeng Wang
2025-09-12  6:58   ` Kefeng Wang
2025-09-11  6:56 ` [PATCH 2/4] mm: page_alloc: add alloc_contig_{range_frozen,frozen_pages}() Kefeng Wang
2025-09-11  6:56 ` [PATCH 3/4] mm: cma: add __cma_release() Kefeng Wang
2025-09-11  6:56 ` [PATCH 4/4] mm: hugetlb: allocate frozen pages in alloc_gigantic_folio() Kefeng Wang
2025-09-11  8:25   ` David Hildenbrand
2025-09-11  9:11     ` Kefeng Wang
2025-09-11 18:56       ` David Hildenbrand [this message]
2025-09-12  6:57         ` Kefeng Wang
2025-09-12  7:18           ` David Hildenbrand
2025-09-12  7:23             ` David Hildenbrand
2025-09-12  9:12               ` Kefeng Wang
2025-09-12 18:07                 ` David Hildenbrand
2025-09-13  4:13                   ` Kefeng 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=667133bd-0021-4d4e-9cde-fc8c1324522a@redhat.com \
    --to=david@redhat.com \
    --cc=20250910133958.301467-1-wangkefeng.wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=jane.chu@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=sidhartha.kumar@oracle.com \
    --cc=vbabka@suse.cz \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.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