Re: git: 48bfd3597654 - main - Add nproc(1)
- In reply to: Mateusz Guzik : "Re: git: 48bfd3597654 - main - Add nproc(1)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 Feb 2023 00:13:52 UTC
Mateusz Guzik wrote in
<CAGudoHGUhRbn7tUgmrk4G0Bc0NhVHOdH82cyN77Rifpw9mExiA@mail.gmail.com>:
|On 2/8/23, Steffen Nurpmeso <steffen@sdaoden.eu> wrote:
|> Mateusz Guzik wrote in
|> <202302081947.318Jlbt6052826@gitrepo.freebsd.org>:
|> ...
|>| Add nproc(1)
...
|>| It aims to be compatible with nproc as found in GNU coreutils.
|>
|> That, "however",
|>
|> ...
|>|+ if (all_flag) {
|>|+ cpus = sysconf(_SC_NPROCESSORS_ONLN);
|>
|> is not compatible -- note i like the FreeBSD way better, and maybe
|> someone should make a bug report even.
|>
|> #?0|kent:$ getconf -a|grep NPROC
|> _NPROCESSORS_CONF 8
|> _NPROCESSORS_ONLN 4
|> #?0|kent:$ nproc
|> 4
|> #?0|kent:$ nproc --all
|> 8
|> #?0|kent:$
|>
|
|Is this from disabling hyperthreading?
Yes (compilations ~30-40% slower when enabled; last i tried).
(Waiting for that tricky FINEIBT thing, maybe then again. Not
that i really have an idea.)
|I have a 40-way box, after doing it I see:
|NPROCESSORS_CONF: 20
|NPROCESSORS_ONLN: 20
|_NPROCESSORS_CONF: 20
|_NPROCESSORS_ONLN: 20
|
|iow it wont make a difference.
I only get that in boxes. On bare metal i see the inactivated
ones.
By the way it was lscpu that requires /sys/ here, nproc works (i
said it does not for the cpuset --count commit). And both
coreutils as well as busybox variants use sched_getaffinity,
indeed.
Ciao,
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)