Re: git: d9d5f2c042a5 - main - cpuset: add --count
Date: Thu, 16 Feb 2023 18:01:32 UTC
On 5 Feb 2023, at 17:28, Alexey Dokuchaev <danfe@freebsd.org> wrote: > > On Sun, Feb 05, 2023 at 04:42:16PM +0100, Mateusz Guzik wrote: >> On 2/5/23, Alexey Dokuchaev <danfe@freebsd.org> wrote: >>> On Sat, Feb 04, 2023 at 05:51:27PM +0000, Mateusz Guzik wrote: >>>> commit d9d5f2c042a51a9f0dd69eb1fc349efd81ffa483 >>>> >>>> cpuset: add --count >>>> >>>> Can be used to count the number of hardware threads in the cpu set. >>>> >>>> For example: [...] >>>> >>>> The intent is to replace calls to sysctl hw.ncpu and kern.smp.cpus >>> >>> Speaking of these two, do we really need both, unless they are not >>> exactly the same? (They do seem so, though.) >> >> They are not, cpuset grabs a pid argument, while nproc only works on itself. > > cpuset? pid argument? But I was not asking about cpuset, I was wondering > whether we need both of these sysctls: > > $ sysctl hw.ncpu > hw.ncpu: 2 > $ sysctl kern.smp.cpus > kern.smp.cpus: 2 One prints mp_ncpus, the other smp_cpus. As far as I’m aware those two are the same for as long as userspace is running, and only differ during early boot before AP bringup (mp_ncpus is how many it will bring up, and smp_cpus counts up as they come online until the two become equal). Jess