mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Graf (AWS), Alexander" <graf@amazon.de>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Robin Murphy <robin.murphy@arm.com>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@kernel.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"nh-open-source@amazon.com" <nh-open-source@amazon.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"The AWS Nitro Enclaves Team"
	<aws-nitro-enclaves-devel@amazon.com>
Subject: Re: [PATCH v2] dma-contiguous: support percentage sizes in cma_pernuma= and numa_cma=
Date: Thu, 19 Nov 2026 12:27:08 +0000	[thread overview]
Message-ID: <28a0f946-af4e-497f-a923-f11b79d94930@amazon.com> (raw)
In-Reply-To: <fa38a878-1735-4682-b208-5de1616f7e4f@samsung.com>


On 19.11.26 12:19, Marek Szyprowski wrote:
> On 14.11.2026 15:53, Alexander Graf wrote:
>> While CMA_SIZE_PERCENTAGE supports percentages for built-in defaults, the
>> CMA allocation kernel parameters currently only take a fixed size argument.
>> That makes it difficult to have a single system image that sizes its CMA
>> allocation based on the available memory. To use CMA as backing pool for
>> large, physically contiguous guest memory, I want to be able to say
>> "allocate 90% of system RAM minus 1 GiB for CMA". Per NUMA node.
>>
>> Extend the CMA parser logic to accept command line options like this:
>>
>>    cma_pernuma=80% numa_cma=0:95%-1G,1:4G
>>
>> To avoid incomplete allocations on parsing errors, check for them
>> before actually allocating.
>
> This looks like an over-engineered feature. I doubt that kernel is the right
> place to implement such advanced sizing. If You need to explicitly control
> the amount of CMA on the target machines, maybe You could do it in some
> scripts deploying the kernel configuration? Calculating it there should be
> much more flexible imho...


It allows to push more policy into a generic boot image, yes. I suppose 
we could push that policy into other bits of pre-boot logic, such as the 
Linux EFI loader, but I'm not convinced it's a net win for simplicity. 
Pushing it into a boot load would mean pushing into UKI for UKI-based 
boot flows, which means bloating systemd-boot. Again, not really great.

Ideally all of this would be policy that only takes effect later at 
boot, so that we don't require pre-boot logic or a reboot. For this to 
work, we would need to have Linux restrict its memory allocations to a 
small'ish region instead of spreading them, maybe to the KHO scratch 
region, or maybe by favoring allocations in phys addr order. At least 
until the boot is at a point where you could perform the allocation. And 
then we would also have large physically contiguous blocks available to 
allocate from and potentially change the tag to CMA.

Any thoughts on how we could best do this?


Alex

      reply	other threads:[~2026-11-19 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261114145340eucas1p2f7699b88eae34f7904cf68109dc3eb4f@eucas1p2.samsung.com>
2026-11-14 14:53 ` Alexander Graf
2026-11-19 11:19   ` Marek Szyprowski
2026-11-19 12:27     ` Graf (AWS), Alexander [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=28a0f946-af4e-497f-a923-f11b79d94930@amazon.com \
    --to=graf@amazon.de \
    --cc=akpm@linux-foundation.org \
    --cc=aws-nitro-enclaves-devel@amazon.com \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=m.szyprowski@samsung.com \
    --cc=nh-open-source@amazon.com \
    --cc=rdunlap@infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=rppt@kernel.org \
    --cc=skhan@linuxfoundation.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

all inboxes | Powered by JetHome®