linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: 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>
Cc: Jianfeng Wang <jianfeng.w.wang@oracle.com>, linux-mm@kvack.org
Subject: CMA, memdescs and folios
Date: Tue, 27 Feb 2024 22:02:36 +0000	[thread overview]
Message-ID: <Zd5b_Ag24bgsbdCF@casper.infradead.org> (raw)

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?

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?

---

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.


             reply	other threads:[~2024-02-27 22:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 22:02 Matthew Wilcox [this message]
2024-03-05  5:30 ` Aneesh Kumar K V
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=Zd5b_Ag24bgsbdCF@casper.infradead.org \
    --to=willy@infradead.org \
    --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 \
    /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