From: Conor Dooley <conor@kernel.org>
To: Suren Baghdasaryan <surenb@google.com>
Cc: akpm@linux-foundation.org, willy@infradead.org, david@redhat.com,
vbabka@suse.cz, lorenzo.stoakes@oracle.com,
liam.howlett@oracle.com, alexandru.elisei@arm.com,
peterx@redhat.com, hannes@cmpxchg.org, mhocko@kernel.org,
m.szyprowski@samsung.com, iamjoonsoo.kim@lge.com,
mina86@mina86.com, axboe@kernel.dk, viro@zeniv.linux.org.uk,
brauner@kernel.org, hch@infradead.org, jack@suse.cz,
hbathini@linux.ibm.com, sourabhjain@linux.ibm.com,
ritesh.list@gmail.com, aneesh.kumar@kernel.org,
bhelgaas@google.com, sj@kernel.org, fvdl@google.com,
ziy@nvidia.com, yuzhao@google.com, minchan@kernel.org,
linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
Minchan Kim <minchan@google.com>
Subject: Re: [RFC 3/3] mm: integrate GCMA with CMA using dt-bindings
Date: Fri, 21 Mar 2025 14:05:58 +0000 [thread overview]
Message-ID: <20250321-unhelpful-doze-791895ca5b01@spud> (raw)
In-Reply-To: <20250320173931.1583800-4-surenb@google.com>
[-- Attachment #1: Type: text/plain, Size: 2936 bytes --]
On Thu, Mar 20, 2025 at 10:39:31AM -0700, Suren Baghdasaryan wrote:
> This patch introduces a new "guarantee" property for shared-dma-pool.
> With this property, admin can create specific memory pool as
> GCMA-based CMA if they care about allocation success rate and latency.
> The downside of GCMA is that it can host only clean file-backed pages
> since it's using cleancache as its secondary user.
>
> Signed-off-by: Minchan Kim <minchan@google.com>
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> ---
> arch/powerpc/kernel/fadump.c | 2 +-
> include/linux/cma.h | 2 +-
> kernel/dma/contiguous.c | 11 ++++++++++-
> mm/cma.c | 33 ++++++++++++++++++++++++++-------
> mm/cma.h | 1 +
> mm/cma_sysfs.c | 10 ++++++++++
> 6 files changed, 49 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index 4b371c738213..4eb7be0cdcdb 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -111,7 +111,7 @@ void __init fadump_cma_init(void)
> return;
> }
>
> - rc = cma_init_reserved_mem(base, size, 0, "fadump_cma", &fadump_cma);
> + rc = cma_init_reserved_mem(base, size, 0, "fadump_cma", &fadump_cma, false);
> if (rc) {
> pr_err("Failed to init cma area for firmware-assisted dump,%d\n", rc);
> /*
> diff --git a/include/linux/cma.h b/include/linux/cma.h
> index 62d9c1cf6326..3207db979e94 100644
> --- a/include/linux/cma.h
> +++ b/include/linux/cma.h
> @@ -46,7 +46,7 @@ extern int __init cma_declare_contiguous_multi(phys_addr_t size,
> extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
> unsigned int order_per_bit,
> const char *name,
> - struct cma **res_cma);
> + struct cma **res_cma, bool gcma);
> extern struct page *cma_alloc(struct cma *cma, unsigned long count, unsigned int align,
> bool no_warn);
> extern bool cma_pages_valid(struct cma *cma, const struct page *pages, unsigned long count);
> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> index 055da410ac71..a68b3123438c 100644
> --- a/kernel/dma/contiguous.c
> +++ b/kernel/dma/contiguous.c
> @@ -459,6 +459,7 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem)
> unsigned long node = rmem->fdt_node;
> bool default_cma = of_get_flat_dt_prop(node, "linux,cma-default", NULL);
> struct cma *cma;
> + bool gcma;
> int err;
>
> if (size_cmdline != -1 && default_cma) {
> @@ -476,7 +477,15 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem)
> return -EINVAL;
> }
>
> - err = cma_init_reserved_mem(rmem->base, rmem->size, 0, rmem->name, &cma);
> + gcma = !!of_get_flat_dt_prop(node, "guarantee", NULL);
When this (or if I guess) this goes !RFC, you will need to document this
new property that you're adding.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-03-21 14:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 17:39 [RFC 0/3] Guaranteed CMA Suren Baghdasaryan
2025-03-20 17:39 ` [RFC 1/3] mm: implement cleancache Suren Baghdasaryan
2025-03-21 5:13 ` Christoph Hellwig
2025-03-21 16:03 ` Suren Baghdasaryan
2025-03-20 17:39 ` [RFC 2/3] mm: introduce GCMA Suren Baghdasaryan
2025-03-21 5:14 ` Christoph Hellwig
2025-03-21 16:13 ` Suren Baghdasaryan
2025-03-20 17:39 ` [RFC 3/3] mm: integrate GCMA with CMA using dt-bindings Suren Baghdasaryan
2025-03-21 14:05 ` Conor Dooley [this message]
2025-03-21 16:14 ` Suren Baghdasaryan
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=20250321-unhelpful-doze-791895ca5b01@spud \
--to=conor@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alexandru.elisei@arm.com \
--cc=aneesh.kumar@kernel.org \
--cc=axboe@kernel.dk \
--cc=bhelgaas@google.com \
--cc=brauner@kernel.org \
--cc=david@redhat.com \
--cc=fvdl@google.com \
--cc=hannes@cmpxchg.org \
--cc=hbathini@linux.ibm.com \
--cc=hch@infradead.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=iommu@lists.linux.dev \
--cc=jack@suse.cz \
--cc=liam.howlett@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=m.szyprowski@samsung.com \
--cc=mhocko@kernel.org \
--cc=mina86@mina86.com \
--cc=minchan@google.com \
--cc=minchan@kernel.org \
--cc=peterx@redhat.com \
--cc=ritesh.list@gmail.com \
--cc=sj@kernel.org \
--cc=sourabhjain@linux.ibm.com \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--cc=yuzhao@google.com \
--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;
as well as URLs for NNTP newsgroup(s).