From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 983213858D28; Mon, 20 Feb 2023 22:46:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 983213858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676933160; bh=NtROaV2QG2ULw289TFVF7V9KWHVYuqmUi2AfbjHh3M8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=R7AWVCHxziKQszsj+IYRyWQ6eIfVqBbuD1SVmqcCBKPUrljf0TlMDmWQFG7Ry8MWH 8ZXsjDOS1xkKzlJ0rrbxcEGOqrrMUEm+9d6j7uxk8btlY0ZGLsOO9ciaazcGt2ieO3 lFZ3pDwUYLuF64Ue9kAD3d9OyEtWLcYXSHvJtT0o= From: "adhemerval.zanella at linaro dot org" To: glibc-bugs@sourceware.org Subject: [Bug libc/30135] sysconf: _SC_NPROCESSORS*: tweak? Date: Mon, 20 Feb 2023 22:46:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.36 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: adhemerval.zanella at linaro dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30135 --- Comment #3 from Adhemerval Zanella --- (In reply to Steffen Nurpmeso from comment #2) > . sysconf and _SC_NPROCESSORS_ONLN is the only standardized variant, > sched_getaffinity() is not a portable interface. >=20 > . I feel "currently available to run threads" pretty much matches that > CPU_COUNT() thing that nproc(1) uses. >=20 > . For example, look at zstd(1), they use sysconf(_SC_NPROCESSORS_ONLN) to > realize -T0. Same for xz(1). > This is _all_ wrong in my cgroup restricted environment, they potentially > "over-thread". >=20 > . Quite the opposite, top(1) is to be changed (a bit strange as my version > is from https://gitlab.com/procps-ng aka /proc based) > If i run it in a cgroup-mutilated environment with three CPUs, it lists a > fourth one that is out of scope! >=20 > . I have not checked virtual machines. It astounds me they use synthesiz= ed > CPU counts instead of the CPU count that truly is available. Fell free to rehash this discussion on libc-alpha, but as I said we already tried it and since it turned out to generate a lot of unseen problems we decided to revert and use sysfs instead. --=20 You are receiving this mail because: You are on the CC list for the bug.=