From: Szabolcs Nagy <nsz@port70.net>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: musl <musl@lists.openwall.com>,
Michael Jeanson <mjeanson@efficios.com>,
Richard Purdie <richard.purdie@linuxfoundation.org>,
Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Subject: Re: sysconf(_SC_NPROCESSORS_CONF) returns the wrong value
Date: Tue, 2 Apr 2019 21:02:53 +0200 [thread overview]
Message-ID: <20190402190253.GT26605@port70.net> (raw)
In-Reply-To: <1391784430.9599.1553623268878.JavaMail.zimbra@efficios.com>
* Mathieu Desnoyers <mathieu.desnoyers@efficios.com> [2019-03-26 14:01:08 -0400]:
> ----- On Mar 26, 2019, at 1:45 PM, Szabolcs Nagy nsz@port70.net wrote:
> > i agree that the current behaviour is not ideal, but
> > iterating over /sys/devices/system/cpu/cpu* may not
> > be correct either.. based on current linux api docs.
> >
> > i don't understand why is that number different from the
> > cpu set in /sys/devices/system/cpu/possible
>
> I suspect both iteration over /sys/devices/system/cpu/cpu* and
> content of /sys/devices/system/cpu/possible should provide the
> same result. However, looking at Linux
> Documentation/ABI/testing/sysfs-devices-system-cpu ,
> it appears that /sys/devices/system/cpu/possible was introduced
> in December 2008, whereas /sys/devices/system/cpu/cpu#/ was there
> pre-git history.
>
> This could explain why glibc uses the iteration method.
>
> Thoughts ?
as far as i can tell the cpu iteration method is valid,
and that directory list cannot change after boot (is this
guaranteed by the linux abi in the future?), so as long
as /sys is mounted we can get the number, but it's fairly
ugly.. does lttng have fallback code if sysconf returns -1?
if it does maybe musl should just do that (or somebody has
to write cancellation safe directory traversal code)
next prev parent reply other threads:[~2019-04-02 19:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-15 21:02 Jonathan Rajotte-Julien
2019-03-16 2:25 ` Szabolcs Nagy
2019-03-16 13:58 ` Mathieu Desnoyers
2019-03-16 14:28 ` Jonathan Rajotte-Julien
2019-03-19 19:11 ` Florian Weimer
2019-03-26 16:23 ` Jonathan Rajotte-Julien
2019-03-26 17:45 ` Szabolcs Nagy
2019-03-26 18:01 ` Mathieu Desnoyers
2019-04-02 19:02 ` Szabolcs Nagy [this message]
2019-04-02 22:38 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190402190253.GT26605@port70.net \
--to=nsz@port70.net \
--cc=jonathan.rajotte-julien@efficios.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mjeanson@efficios.com \
--cc=musl@lists.openwall.com \
--cc=richard.purdie@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).