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: 13493826 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 71A46C4332F for ; Fri, 15 Dec 2023 00:06:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E70C06B05FC; Thu, 14 Dec 2023 19:05:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E20F06B05FD; Thu, 14 Dec 2023 19:05:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0F326B05FE; Thu, 14 Dec 2023 19:05:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BF2686B05FC for ; Thu, 14 Dec 2023 19:05:59 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 86F50404DE for ; Fri, 15 Dec 2023 00:05:59 +0000 (UTC) X-FDA: 81567109638.14.2D34243 Received: from gentwo.org (gentwo.org [62.72.0.81]) by imf04.hostedemail.com (Postfix) with ESMTP id 0008440004 for ; Fri, 15 Dec 2023 00:05:57 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=softfail (imf04.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=1702598758; 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: references; bh=bBtr7LN/hpfo2MNuOcxcIEm+IlbMg9kH3NHufS4DZSg=; b=Oad1ipIX8EAqirItrLNbC1sbImVWaOchCBqCXw/yd309QOdXEbz0gkFyMSfWi90Hh47tl0 U5m//iH7PuTWuDXeikAB9iZ704q6VF+kFz4D0aMfqD2lfTgs/ktfPA62x6bF+hQk2986vq uE3M7K4lUigbOjurYnDwiyDh7PpEdCI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=softfail (imf04.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=1702598758; a=rsa-sha256; cv=none; b=wWe+G5hILTfWfLBijZMcWM22MVi11lVszUvoIz87MvKifIN9ayBG55hhG8Wvip15vvDKq7 6O6sJ4amKhkYqjyGhbB5B9utE0mNJe1M/vIOzZLwcpTV2Tc24AMuJB56d7ZFoRl9c7z+xR tbW4/PucZSkzPYobTuWnl3UTZqrjjUI= 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-Rspamd-Queue-Id: 0008440004 X-Rspam-User: X-Stat-Signature: dokunahaukfgy976nxi9xr7xhzwbk7fc X-Rspamd-Server: rspam01 X-HE-Tag: 1702598757-117518 X-HE-Meta: U2FsdGVkX1+weeAeGGYDVETf4iYa+mCP9UV/cO2LzRTbDVB+Hs61Z1nLnaWOVdCjodngHX4bfG400Af3VKIN9hxOGa4vkX0p25eWupWF/Iohedsb0T5Ex0dG8Xn7iAD5kzzOGpd1bW970UT2g5V29IOsz7vu9g4FOdFBsz+AD7rg5TDDmBIK7/HcOV/b5ULVeJVG0U1Cz2e39q2igRyaC22CEFhTor9XpQie/TZ3EuCqWfGKIxWrzKybZp97YBPjaQr4y/KgNy4fgxtHvW2mhWjPGUZr8wmm43ssTPtE/3UcsShBDX/gHbf0VdKkAKBrWb0NvVUkmD+gPyBC7LlL5IyZtveHhYN62iWv+Adrzt7g/te8jpqPM0W1SAfK0KN0Bvmx/aXylXe/9Ud8Mn3vr4AKeFdyJmCJch1FXrpApPaCdPWJ7hfrh/8SFfQXMrv061jBVJOOf9AJShBbLN8wXRnDFSpSdsebZU4ANiVHwpz9fAek+4k+Vvsp6Ay9tEM5WeF04WZV15jI1djhAffjAhfns+oW72zNS6jQ+E+XjLegt1Cok+r3WERuQEJqE10omm1ATGX1ODDrMzAzPXaBg4yhQftuwDBvKu+qeKZhVuc8Cr14ZShowUSl+wpK5/h9OC25QeV33jMj3BvT0URiuIlD1kyTIPEHuDTTbpUvQlanSgp6V9D4sLfzfXDIqXdHlJpklu+LDSxBfAk1s6QJRjVL3n9jNytN3/wJB4wXnKQFD+ZJbSU/b9llvIJ4cMAmvd53C82RwTbcoFIOYwQdK824rfQHx6Opsk8eRTBuxB/xOM8dSE41Z7Oa5sSPtLW7TMVYVYMsROU7AYKg+BIFXZzbnyBLCQB241Uz/xc37UWIgusWcL8Lt73UWPTiY+b6AgYgU2FBeqBL2IewUuiXPMdd2IC4Lq4seHOjF1j3KX+eYYZtEl/weep7f103VwegBF070FhlUW72GNNzT2o bVH/hN82 N86tK0I4yTsrdj0EOt0hd2iWtc5LnF2A8UAaKOE+7E4OjMuiCa7IjT00HiRYxs2UHoGZrKZ2lumBwqxRIQqOsdKm93D8zML9hAMjuwTB2J+KOQL+y0TToIL0uaMBP2+mLc4RTqiWlLXYrm41axA2KPzFx4RA9+jJ4NBK/UxpnLkWN3k/R3r910zOgDbz9rBUn7PTmFAdON11q+G9rLXF2aygJ5RqYpEG/WwPO40pPSQNSj14JdTMf7vmWVRuNPGU8OU7L+WAgAIlJSAA2i7f4LIn4eI8bja3SmYNtYFBZeVoXWqDmUbjaEMeXHI5yWsomjOGE 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. 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"