From: Eric Mackay <eric.mackay@oracle.com>
To: mark.rutland@arm.com
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, cl@linux.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: Re: [PATCH] ARM64: Dynamically allocate cpumasks and increase supported CPUs to 512
Date: Tue, 16 Jan 2024 13:06:33 -0800 [thread overview]
Message-ID: <20240116210633.116278-1-eric.mackay@oracle.com> (raw)
In-Reply-To: <ZaZ_xK5QHVPSD7N6@FVFF77S0Q05N>
On Tue, Jan 16, 2024 1:08:20PM +0000, Mark Rutland wrote:
> 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.
The suggestion for >= 256 may have been a zero-index/one-index mixup.
It seems > 256 was chosen as the cutoff simply because it preserves existing behavior.
The patch description seems to imply there was pushback from distro maintainers on just increasing
the default NR_CPUS.
The existing default value of 256 is probably already a strain for smaller ARM systems, to which
x86-64 isn't a reasonable comparison. I'm not sure what the reaction to increasing from 64 to 256
in 2019 was like, but picking a pivot point for CPUMASK_OFFSTACK beyond 256 may skew the balance
even less in favor of smaller ARM systems.
next prev parent reply other threads:[~2024-01-16 21:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 0:05 [PATCH] ARM64: Dynamically allocate cpumasks and increase supported CPUs to 512 Christoph Lameter (Ampere)
2024-01-15 15:39 ` Russell King (Oracle)
2024-01-16 7:10 ` Kefeng Wang
2024-01-16 9:28 ` Russell King (Oracle)
2024-01-16 13:08 ` Mark Rutland
2024-01-16 21:06 ` Eric Mackay [this message]
2024-01-17 19:59 ` Christoph Lameter (Ampere)
2024-01-15 23:59 ` Eric Mackay
2024-01-16 11:24 ` Russell King (Oracle)
2024-01-16 21:06 ` Eric Mackay
2024-01-17 20:01 ` Christoph Lameter (Ampere)
2024-01-18 17:53 ` Eric Mackay
2024-01-23 23:55 ` [PATCH v2] " Christoph Lameter (Ampere)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240116210633.116278-1-eric.mackay@oracle.com \
--to=eric.mackay@oracle.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=Matteo.Carlini@arm.com \
--cc=Valentin.Schneider@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=dave.kleikamp@oracle.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=robin.murphy@arm.com \
--cc=vanshikonda@os.amperecomputing.com \
--cc=yang@os.amperecomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).