From nobody Fri Feb 10 00:13:52 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PCZ3G2bYsz3pfMV; Fri, 10 Feb 2023 00:14:02 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PCZ3G0Tn6z3NvF; Fri, 10 Feb 2023 00:14:02 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Authentication-Results: mx1.freebsd.org; none Date: Fri, 10 Feb 2023 01:13:52 +0100 Author: Steffen Nurpmeso From: Steffen Nurpmeso To: Mateusz Guzik Cc: Mateusz Guzik , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 48bfd3597654 - main - Add nproc(1) Message-ID: <20230210001352.DUAuj%steffen@sdaoden.eu> In-Reply-To: References: <202302081947.318Jlbt6052826@gitrepo.freebsd.org> <20230208202736.L7hpB%steffen@sdaoden.eu> Mail-Followup-To: Mateusz Guzik , Mateusz Guzik , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org User-Agent: s-nail v14.9.24-403-gdc9ff6b368 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. X-Rspamd-Queue-Id: 4PCZ3G0Tn6z3NvF X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15987, ipnet:217.144.128.0/20, country:DE] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mateusz Guzik wrote in : |On 2/8/23, Steffen Nurpmeso 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)