Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Feb 2023 18:01:32 +0000
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Alexey Dokuchaev <danfe@freebsd.org>
Cc:        Mateusz Guzik <mjguzik@gmail.com>, src-committers <src-committers@freebsd.org>, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: d9d5f2c042a5 - main - cpuset: add --count
Message-ID:  <A5FA934E-1DAA-45A9-9900-3E8A91BEF4FC@freebsd.org>
In-Reply-To: <Y9/nUguGt6mlksGF@FreeBSD.org>
References:  <202302041751.314HpRrn042970@gitrepo.freebsd.org> <Y98dOenW9mulqNzm@FreeBSD.org> <CAGudoHGn1-zZTAX4r1h_xMpaA4zd9b2y4_N21Jah1pdGsqsuQA@mail.gmail.com> <Y9/nUguGt6mlksGF@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5 Feb 2023, at 17:28, Alexey Dokuchaev <danfe@freebsd.org> wrote:
>=20
> 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
>>>>=20
>>>>  cpuset: add --count
>>>>=20
>>>>  Can be used to count the number of hardware threads in the cpu =
set.
>>>>=20
>>>>  For example: [...]
>>>>=20
>>>>  The intent is to replace calls to sysctl hw.ncpu and kern.smp.cpus
>>>=20
>>> Speaking of these two, do we really need both, unless they are not
>>> exactly the same?  (They do seem so, though.)
>>=20
>> They are not, cpuset grabs a pid argument, while nproc only works on =
itself.
>=20
> cpuset? pid argument?  But I was not asking about cpuset, I was =
wondering
> whether we need both of these sysctls:
>=20
> $ 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=E2=80=99m 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A5FA934E-1DAA-45A9-9900-3E8A91BEF4FC>