From patchwork Fri Dec 15 00:05:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Christoph Lameter (Ampere)" X-Patchwork-Id: 13493827 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 49921C4332F for ; Fri, 15 Dec 2023 00:06:36 +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:Message-ID:Subject:cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=qUQKLGf4tM2f4aTieBY1NGHwfAwWEkyuT/Ck4yXrBYA=; b=XLU1dwGpYUMJhjafBXuPKXpOwt wPFBmPlbb3OrEmAdb/5QJ54aA3m1o9yAlWcTCptDIU+j8PZTiMb3fE/PI/kw+/W1dEodY2ENxF5Um H5ALFOFp+tHbw5/jTaz5zrUo4cZcfyvYZv+Egk2JolkMqM3NfPvP1Z088U/79HawrYx1JeELJyHBc gkOWV/B+/iOM1oQNB9HNplSUlhGaqoJbvgTRG8YoFew7LN54Fk1OvuJ4sIpnH45FIZKzcLKSNDqaK aL0P/H1DibEJL8IkZzNJmhExDCyb1OmyWS9ELLEu6gGWiOs9OH7TfvxclajxR1+hw21o6uPpkYOti keWyVxSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDviO-001bZY-0k; Fri, 15 Dec 2023 00:06:04 +0000 Received: from gentwo.org ([2a02:4780:10:3cd9::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDviK-001bVw-0G for linux-arm-kernel@lists.infradead.org; Fri, 15 Dec 2023 00:06:02 +0000 Received: by gentwo.org (Postfix, from userid 1003) id 8FEFF40E8E; Thu, 14 Dec 2023 16:05:56 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 8D6B440E89; Thu, 14 Dec 2023 16:05:56 -0800 (PST) Date: Thu, 14 Dec 2023 16:05:56 -0800 (PST) From: "Christoph Lameter (Ampere)" To: Anshuman Khandual cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Valentin.Schneider@arm.com, Vanshidhar Konda , Jonathan Cameron , Catalin Marinas , Robin Murphy , Dave Kleikamp , Matteo Carlini , akpm@linux-foundation.org, yang@os.amperecomputing.com Subject: [PATCH] ARM64: Dynamically allocate cpumasks and increase supported CPUs to 512 Message-ID: <794a1211-630b-3ee5-55a3-c06f10df1490@linux.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231214_160600_155641_098AB115 X-CRM114-Status: GOOD ( 10.74 ) 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. Signed-off-by: Christoph Lameter (Ampere) Tested-by: Eric Mackay --- This was discussed earlier and this updated patch was proposed at https://lore.kernel.org/linux-arm-kernel/6a854175-5f89-c754-17b8-deda18447f1f@gentwo.org/T/ 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"