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: 13528285 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1685C47258 for ; Tue, 23 Jan 2024 23:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Message-ID:In-Reply-To: Subject:cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=l1h8BAm0zfAsIOWfsNm/BnXMJ/6niJve56nwCCHBNyA=; b=FCadapT3S0uqKhfZOnOofiUU47 a8920uDg/nLyC0fem8rUI1+9qIzveVxzDCo5mDSjP7ireYFx6fq1sq7VCcGmNabgytxfn7nkQihQZ a1e8t7K5WD5fjQUmD+Q75HBUpy3OX8Ct0Byi4JzkOuxdDrgIpPYCJeid/0CQbPBPW+sEz+GltH2j8 xIIy/7PScOhoVoBFin2TgXn9aX2QZGKXnaOnT5oy8Ge0KXhqDF/vNFA4YokpPqdlivg5zTWx3XVQT DHM/bYbG7vfmPDG4/A441ddYRWpX3QH9UgEmQ3t94WfWFyUROM516A8mJNHwH7Qf/cKgn1L62cCs1 7xrHDakA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSQc0-000rkT-2B; Tue, 23 Jan 2024 23:55:24 +0000 Received: from gentwo.org ([62.72.0.81]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSQbw-000rjX-1f for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 23:55:22 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240123_155520_573413_02758355 X-CRM114-Status: GOOD ( 11.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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"