From: Aneesh Kumar K V <aneesh.kumar@linux.ibm.com>
To: Matthew Wilcox <willy@infradead.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Michal Nazarewicz <mina86@mina86.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
"npiggin@gmail.com" <npiggin@gmail.com>
Cc: Jianfeng Wang <jianfeng.w.wang@oracle.com>, linux-mm@kvack.org
Subject: Re: CMA, memdescs and folios
Date: Tue, 5 Mar 2024 11:00:37 +0530 [thread overview]
Message-ID: <d7c2316d-5f8b-4706-9014-a6ec1b14594f@linux.ibm.com> (raw)
In-Reply-To: <Zd5b_Ag24bgsbdCF@casper.infradead.org>
On 2/28/24 3:32 AM, Matthew Wilcox wrote:
> It may be helpful to look at
>
> https://kernelnewbies.org/MatthewWilcox/Memdescs
>
> I don't yet have a plan for what CMA should look like in the memdesc
> future. Partly I just don't know CMA very well. Some help would
> be appreciated ...
>
> First, I'm pretty sure that cma allocations are freed as a single
> unit; there's no intended support for "allocate 2000MB from CMA, free
> 500MB-1500MB, use the first 500MB for one thing and the last 500MB for
> something else". Right?
>
> Second, CMA doesn't actually grub around inside struct page itself,
> so it has no dependencies on what struct page contains. Is that true?
>
> Third, I don't see where CMA manipulates the page refcount today.
> Does it rely on somebody else setting the page refcount to 1 before
> giving the pages to CMA?
>
isolate_freepages_range -> split_map_pages -> post_alloc_hook -> set_page_refcounted
> Fourth, do users of CMA rely on pages being individually refcounted?
> Is there a reason you've never implemented an equivalent to __GFP_COMP
> before?
for powerpc kvm hash page table usage (kvm_alloc_hpt_cma()/kvm_free_hpt_cma())
I guess we don't expect them to be individually refcounted.
>
> ---
>
> My strawman proposal is that, in a memdesc world, the individual pages
> that are free within CMA get a type 0 subtype to make them readily
> identifiable in memory dumps. At allocation time, the caller will pass
> in a memdesc to manage the pages (and CMA will assign it to all the pages,
> just like the BuddyAllocator will).
>
> As a step towards that, we can change CMA soon to return pages which have
> a zero refcount. That should catch any users which rely on individual
> refcounts.
next prev parent reply other threads:[~2024-03-05 5:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 22:02 Matthew Wilcox
2024-03-05 5:30 ` Aneesh Kumar K V [this message]
2024-03-05 13:20 ` David Hildenbrand
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=d7c2316d-5f8b-4706-9014-a6ec1b14594f@linux.ibm.com \
--to=aneesh.kumar@linux.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=jianfeng.w.wang@oracle.com \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=mina86@mina86.com \
--cc=npiggin@gmail.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