From patchwork Tue Jan 23 23:55:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Christoph Lameter (Ampere)" X-Patchwork-Id: 13528284 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48331C47DDB for ; Tue, 23 Jan 2024 23:55:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B10956B0080; Tue, 23 Jan 2024 18:55:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AC16B6B0085; Tue, 23 Jan 2024 18:55:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D7C96B0087; Tue, 23 Jan 2024 18:55:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 86C876B0080 for ; Tue, 23 Jan 2024 18:55:20 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 50153C0196 for ; Tue, 23 Jan 2024 23:55:20 +0000 (UTC) X-FDA: 81712234800.26.E604BCA Received: from gentwo.org (gentwo.org [62.72.0.81]) by imf25.hostedemail.com (Postfix) with ESMTP id A2977A0008 for ; Tue, 23 Jan 2024 23:55:18 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; spf=softfail (imf25.hostedemail.com: 62.72.0.81 is neither permitted nor denied by domain of cl@linux.com) smtp.mailfrom=cl@linux.com; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=linux.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706054118; a=rsa-sha256; cv=none; b=QNa8G7z9QdOp9g0YP/p9jw1yUhWP3qzwPShTyKtfccX0xWL3i44TB9IPoT2IFFJSk6uFxs 0fRcdk0w2pOu3TpimdijVVL/UHUQQ/jOCMR4Dez5MhS22rra4aPcG5lJthGLg/tHcMq5pr 17POJpEjCG96g76WvBtgeHhowVYAZ+0= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=softfail (imf25.hostedemail.com: 62.72.0.81 is neither permitted nor denied by domain of cl@linux.com) smtp.mailfrom=cl@linux.com; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=linux.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706054118; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F1ByIlNM5wcfqz5H6moYd531AOai1hYx500Y0jRmjDg=; b=c1FcEA0NBt50RNpTswnNVG9U7aMSXRi2vYpis6Et0BsD48ldaX3PTf7aUNeau5207V+4MQ mw09BtP3Kt3YXoOyT/GvKo2EMf5TdGJtYTqb4cBtAiA1BOX+dCUfpkOcl2416VpaALOgAz YVUjyee4fq58MHb43eRmsBLAzK6JU8s= Received: by gentwo.org (Postfix, from userid 1003) id 0EC8640A93; Tue, 23 Jan 2024 15:55:17 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 0B6AC40788; Tue, 23 Jan 2024 15:55:17 -0800 (PST) Date: Tue, 23 Jan 2024 15:55:17 -0800 (PST) From: "Christoph Lameter (Ampere)" To: Eric Mackay cc: Jonathan.Cameron@huawei.com, Matteo.Carlini@arm.com, Valentin.Schneider@arm.com, akpm@linux-foundation.org, anshuman.khandual@arm.com, catalin.marinas@arm.com, dave.kleikamp@oracle.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux@armlinux.org.uk, robin.murphy@arm.com, vanshikonda@os.amperecomputing.com, yang@os.amperecomputing.com Subject: [PATCH v2] ARM64: Dynamically allocate cpumasks and increase supported CPUs to 512 In-Reply-To: <20240118175350.23344-1-eric.mackay@oracle.com> Message-ID: <7ab6660e-e69f-a64b-0de3-b8dde14f79fa@linux.com> References: <20240118175350.23344-1-eric.mackay@oracle.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A2977A0008 X-Stat-Signature: 3afd3dbki9w4df4s7i19cdeoko9bj4xx X-HE-Tag: 1706054118-129961 X-HE-Meta: U2FsdGVkX1+hqEbFFBWsev8aW5sfFZj+kwRTFj7rqFXF3Or+MlK4kTdHWoWlzynmStKP5Vl/xJ4sqNlIgNP1FPn50ZqKbCfQxiagf7skPgfV/4MXauSpTJGhvyEUIDhbTnTwlFwWxuYtI9Nx9qd30R5G0x6HmllEOI+gP1xFwf4KtBWYEtZdVo5wCP6t8NfDzwxErcTWckay2vaeB0LmBof+OLvSGAmc57lhVuI6kW/asXuQtTm1KRysFeTLP/jaOVFKxDarMfN0k8eyoIUrE1nruqxfC61N9CzHWqFo2rbiZIKztXNssrxE4bOhJXRgFmhH4/LdYq/vSryVTEsoJklViewT9mGO8Hy6m4Tdmj0c4vUOXhdx2o2Q5kQtXdQvpagSUDB8DaiYcrxXICLK9j2+4UiyGqKXmzzu70dfOMpNcuMFuGEXcLsMqMEtDZ5UEXMNKtJDhdj4KO9XIDcXLeZyi092oQ4ETl8+ysjXfE1fuXv5Dqe2lvsZo4teIyLGEKDZFmSXf1OswFd4QtuJ9JceMJ4mJvk5D8D4Uao4+beVbSY/vnrleOer3BqT/YPnZiWGfdWdr7CSsNbGc2GZIidoh4rHbF/Y0i0ud1S3dff2smi2tOXvT6SidgkGDhFcjHyh2PJduk97mUlUnZFoWG113EE9SuSHoZIyRQ4tVlWyHPuSX4HRskFlQidqeZqq36i1BtQDesR90LhfmD4pmrVMx40dOGaauAhfTQh+cPx48FrNCX8Ytyf6gbkoPTlljT7JxBopn7fSj1S9OJU6OmZlVLYDQomzvxU9oR7SdDYn6i7+YBvVNtJNdZxgvCRpkl9BFFgQLGw34QuVtojaaBJCthEON/U1/UC45gvrvNZFRs4o123YKe/ImujD7Iw2nsvQf8wcenKhXja7kD3SeP3DweJpikogmiEQ3ypIZS5fyk7OQQnCaBjqx25IRWXuUO6mPI77oWW8YfO9Mu4 mwxWLXc/ apg8ktI9/3ryOseyKQLXVsCXGO4WSTBJiDNbSnG30cP29jMdXTAk8TPd4pudLXmsTNccPle/9XfPevNpQjR1mkyuIMjfE8Ib5EvwOyLn+Tpnh3SkOHTFkbtWK5DwGn5bitxQdLtluCjvxC0Pr1SHG0OZaANGLrJmC2Tn3kte9ykUarqxx+JdT5jQgPGClodarPLUDjC8zXqM89vb0YfepDZLFxQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Ampere Computing develops high end ARM processor that support an ever increasing number of processors. The default 256 processors are not enough for our newer products. The default is used by distros and therefore our customers cannot use distro kernels because the number of processors is not supported. One of the objections against earlier patches to increase the limit was that the memory use becomes too high. There is a feature called CPUMASK_OFFSTACK that configures the cpumasks in the kernel to be dynamically allocated. This was used in the X86 architecture in the past to enable support for larger CPU configurations up to 8k cpus. With that is becomes possible to dynamically size the allocation of the cpu bitmaps depending on the quantity of processors detected on bootup. This patch enables that logic if more than 256 processors are configured and increases the default to 512 processors. Further increases may be needed if ARM processor vendors start supporting more processors. Given the current inflationary trends in core counts from multiple processor manufacturers this may occur. Tested-by: Eric Mackay Signed-off-by: Christoph Lameter (Ampere) --- V1->V2 - Keep quotation marks - Remove whiltespace damage - Add tested by Index: linux/arch/arm64/Kconfig =================================================================== --- linux.orig/arch/arm64/Kconfig +++ linux/arch/arm64/Kconfig @@ -1407,7 +1407,21 @@ config SCHED_SMT config NR_CPUS int "Maximum number of CPUs (2-4096)" range 2 4096 - default "256" + default "512" + +# +# Determines the placement of cpumasks. +# +# With CPUMASK_OFFSTACK the cpumasks are dynamically allocated. +# Useful for machines with lots of core because it avoids increasing +# the size of many of the data structures in the kernel. +# +# If this is off then the cpumasks have a static sizes and are +# embedded within data structures. +# +config CPUMASK_OFFSTACK + def_bool y + depends on NR_CPUS > 256 config HOTPLUG_CPU bool "Support for hot-pluggable CPUs"