Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp434044rdb; Tue, 16 Jan 2024 05:08:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEj1vooVOW1fOtO0jFAZS0ACeicczXSiUm58GuDqTMu9gGrptPOiDaTPm+fQsdXrOqe8+Aw X-Received: by 2002:a05:6512:3d05:b0:50e:7410:d5b0 with SMTP id d5-20020a0565123d0500b0050e7410d5b0mr3646965lfv.28.1705410535911; Tue, 16 Jan 2024 05:08:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705410535; cv=none; d=google.com; s=arc-20160816; b=yLCfwIwgCQjZyYz3WPEWRjPLWIOaWnr6ZTlsgx8wTcs8dYltPudOkkQTyO3ChVFo6G wB2Km7KuOJVUU2QrNH59JK/YK+qdgS9ndVHAlhalVp6fbDt/4Y5Dk53qpk8t3c0TV1ge 9C0ex+AuhLU1rvNPq+LSIgENR04ZmGgoSM6XmX/Ch1BubQcpEIg7FXwBIbHWccHjDeCm uMT3SviVw9GwyJGCQrClHPqfV931uS3J8Yrc55jhR6MnfOaBXySBy6O6lpbq9SI6/FsV Tr5PqsWHJjAvQJ1e31U+dqGAUEZv8d3eya3UBxB2VQM7o80UkRwSwLi3Fggsv5ZkTsI5 R1zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=27xOCsyTlyXG6BNSUnPkiLQDb005NEOhrhz0UhCT3W0=; fh=e9JmvWazalwWsiiei+pO8i5MUfm2fBVX8e7V6QOOO14=; b=kVE+WnYwhkGWksdN+PKZQGpIuEJfAW4Kpfk7XW5cVQAn0mZjPXB9FuzT4M36C83//l T+2AIhJ4AYCX+qISlH5Iaph6/3Qx+4DIGAal5+SoshZR1hUHBqB+hGzmGavGhethYr+x gnk1uRnIoT3VXXOpCABl6yzYZVhhOLuo8XAwgEwHX02hrFSTjU5w4arYqnI9smPk1Hsj e6+hWPplSdfWeOg6pEIrUxvBdBACv3s2/Le7QvD9H60wqMNR1AO4FglS9UWdN0EaELz8 EXURJBTXHMdDCi/rmjFl+DbDAgJ8XClyjPfLhUHdFhRrj8cq9sxSovUAvfEyhC/arTEW P4ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n16-20020a170906089000b00a28f023581csi4893846eje.630.2024.01.16.05.08.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 05:08:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9C5D11F24555 for ; Tue, 16 Jan 2024 13:08:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4713E1BDCB; Tue, 16 Jan 2024 13:08:42 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BC861BDDA for ; Tue, 16 Jan 2024 13:08:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 386F12F4; Tue, 16 Jan 2024 05:09:21 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.90.186]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 138893F6C4; Tue, 16 Jan 2024 05:08:29 -0800 (PST) Date: Tue, 16 Jan 2024 13:08:20 +0000 From: Mark Rutland To: "Russell King (Oracle)" Cc: "Christoph Lameter (Ampere)" , Anshuman Khandual , 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: Re: [PATCH] ARM64: Dynamically allocate cpumasks and increase supported CPUs to 512 Message-ID: References: <794a1211-630b-3ee5-55a3-c06f10df1490@linux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jan 15, 2024 at 03:39:00PM +0000, Russell King (Oracle) wrote: > On Thu, Dec 14, 2023 at 04:05:56PM -0800, Christoph Lameter (Ampere) wrote: > > +# 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 > > Should that be ">= 256" ? I don't think that ">= 256" makes sense. Note that since the cpumasks are arrays of unsigned long, they're chunked into groups of 64 bits: 2 to 64 cpus: 1 x unsigned long => 8 bytes 65 to 128 cpus: 2 x unsigned long => 16 bytes 129 to 192 cpus: 3 x unsigned long => 24 bytes 193 to 256 cpus: 4 x unsigned long => 32 bytes 257 to 320 cpus: 5 x unsigned long => 40 bytes .. and so if a mask for 256 CPUs is too big to go in the stack, so is any mask for 193+ CPUs, and so ">= 256" should be clamped down to ">= 193" or "> 192". The boundary should be just after a multiple of 64. How did we choose 256 specifically? I note that x86-64 allows 512 CPUs before requiring CPUMASK_OFFSTACK, and I see that powerpc selects CPUMASK_OFFSTACK when NR_CPUS >= 8192. Mark.