From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=210.118.77.11 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795087203; b=KulDzWp0AKhQnDx39WkzsaKf0/N5PTKGY1cHAmbb7g0nrRbEYZTZJ/oWla5o3PfeKwFR /mwz8cJzyuZfIddwKns2ZuhWc6/0MwIcs0p9irEmfV+PTkg9DKCoXGOe/n3MsZBzkFMgy I6IjnTmmC8poC7lm35tN7raEzU+5tFrrwjy2oJghtKi2Lnbg2g01TwBdN+gUS/XeXrnt7 YDIZ76MORVEPYBXWQxQd3q53EdI6DW4x1jdFXlaOBC9gWlNvV6jsrZdtPSRdq8zsWZvkt uTNdhfRRcZvb5SV2yZSd1kxehPtBeBqpGyo1mtZ4yHxvfRJyhhxV2JL06gXlgBpSdkw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795087203; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc: Content-Language:From:In-Reply-To:Content-Transfer-Encoding: X-CMS-MailID:X-Msg-Generator:Content-Type:X-RootMTR:X-EPHeader: X-CMS-RootMailID:References; bh=QjhX4svqgENH27PAAoOn+DesXkt70aYnU/WTBMxaRlI=; b=4ix0xdLBZ6indMJ1pyjMhBro3CzeBfK4L/Jb+SmqxJsPGlo/KUmOmChLrZgiTPYX2eC7 xAl6Pleo9adLsBq3GCT3gwivzCRa1OfKkujcLb45idyo/H2N1skuK6X8oeEupuGR5Bv/w f2JrxW5E371mQ2nme7Iy9wze9HzQr55FLST+F9cj+EWn4XgerbKSppjVGSJ+wf43M+EFl nnh9B71SoE4M6lkjSjI8o/Ib+ANVZiHFBcXno10qGeQ/bGRMAvihYXZS72d2GMCyrHiAW gF6uniVoa13Mu5x5QgfRjqbhxTzGfvqCbZqt8YM9sRNauisdyl2rrG/i5JtfhAxZ5Hg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass header.d=samsung.com header.i=@samsung.com header.a=rsa-sha256 header.s=mail20170921 header.b=qPqvot4d; arc=none smtp.remote-ip=210.118.77.11 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40DA9606A320 for ; Thu, 19 Nov 2026 11:20:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 40DA9606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.a=rsa-sha256 header.s=mail20170921 header.b=qPqvot4d Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20261119112000euoutp012662580ad2f9b79da03a1731858714b4~pbkw-Fi8E2087620876euoutp01E for ; Thu, 19 Nov 2026 11:20:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20261119112000euoutp012662580ad2f9b79da03a1731858714b4~pbkw-Fi8E2087620876euoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1795087200; bh=QjhX4svqgENH27PAAoOn+DesXkt70aYnU/WTBMxaRlI=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=qPqvot4d9oG/iUwx+maS5xSX5X6XoywUKZkobSFZ98vTznvDeQMcEYOwy0iWW8oWm /Gy9af7GwuNK0BXMNEWESJdOLJAtysBA3piqxHZOIWBPykY8Aye2lYL6YUzUmJLAhb IkRymHot4ISztBj69JwR4JvLdW7dhTwgmmqIM/Ro= Received: from eusmtip2.samsung.com (unknown [203.254.199.222]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20261119111959eucas1p2bd4a85981864901886c2f6e9681855f3~pbkwmyhTr0716707167eucas1p2y; Thu, 19 Nov 2026 11:19:59 +0000 (GMT) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20261119111959eusmtip2279ca40ca3a7bf37097daea13deb112f~pbkv7OMEZ1620516205eusmtip2I; Thu, 19 Nov 2026 11:19:59 +0000 (GMT) Message-ID: Date: Thu, 19 Nov 2026 12:19:58 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Betterbird (Windows) Subject: Re: [PATCH v2] dma-contiguous: support percentage sizes in cma_pernuma= and numa_cma= To: Alexander Graf , linux-kernel@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Randy Dunlap , Robin Murphy , linux-doc@vger.kernel.org, iommu@lists.linux.dev, Andrew Morton , David Hildenbrand , Mike Rapoport , nh-open-source@amazon.com, linux-mm@kvack.org, The AWS Nitro Enclaves Team Content-Language: en-US From: Marek Szyprowski In-Reply-To: <20261114145328.1307-1-graf@amazon.com> Content-Transfer-Encoding: 7bit X-CMS-MailID: 20261119111959eucas1p2bd4a85981864901886c2f6e9681855f3 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20261114145340eucas1p2f7699b88eae34f7904cf68109dc3eb4f X-EPHeader: CA X-CMS-RootMailID: 20261114145340eucas1p2f7699b88eae34f7904cf68109dc3eb4f References: <20261114145328.1307-1-graf@amazon.com> 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... > Signed-off-by: Alexander Graf > --- > v1 -> v2: > > - Reject an empty numa_cma= and a trailing comma (Sashiko) > - Keep the last valid size for each option or node, so an explicit 0 > now overrides a percentage (Sashiko) > - Parse percentages as plain decimal, and reject sizes that a 32-bit > phys_addr_t cannot hold > - Reject a bare cma_pernuma or numa_cma without "=", which mainline > dereferences as NULL > - Rework the kernel-parameters.txt text accordingly > > v1: https://lore.kernel.org/all/20261111140440.43024-1-graf@amazon.com/ > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland