mailing list of musl libc
 help / color / mirror / Atom feed
From: Vincent Donnefort <vincent.donnefort@arm.com>
To: Alexander Monakov <amonakov@ispras.ru>
Cc: musl@lists.openwall.com
Subject: Re: [musl] [PATCH] sysconf: add _SC_NPROCESSORS_CONF support
Date: Wed, 5 May 2021 18:05:06 +0100
Message-ID: <20210505170506.GA260789@e120877-lin.cambridge.arm.com> (raw)
In-Reply-To: <alpine.LNX.2.20.13.2105051702240.5297@monopod.intra.ispras.ru>

On Wed, May 05, 2021 at 05:04:53PM +0300, Alexander Monakov wrote:
> 
> 
> On Wed, 5 May 2021, Vincent Donnefort wrote:
> 
> > Currently, _SC_NPROCESSORS_CONF is always equal to _SC_NPROCESSORS_ONLN.
> > However, it is expected from the first one to give the total number of CPUs
> > in the system, while the later must return only the number of CPUs which
> > are currently online. This distinction is important for a software such as
> > trace-cmd. Trace-cmd is a front-end for the kernel tracing tool ftrace.
> > When recording traces, trace-cmd needs to get the total number of CPUs
> > available in the system (_SC_NPROCESSORS_CONF) and not only the online ones
> > otherwise if a CPU goes offline some data might be missing.
> > 
> > Hence, add a specific method to get _SC_NPROCESSORS_CONF, based on the
> > sysfs CPU entries /sys/devices/system/cpu/cpu[0-9]
> 
> Why do the opendir instead of reading from /sys/devices/system/cpu/possible?
> The online/offline/possible CPU masks are documented in
> linux/Documentation/ABI/testing/sysfs-devices-system-cpu and
> linux/Documentation/cputopology.txt
> 
> Alexander

Could indeed use one of the CPU mask. "present" is probably better suited for
this usage. "possible" seems to have a different behavior on different
architectures e.g it is CONFIG_HOTPLUG dependent on x86.

Will do a V2 based on the present mask.

-- 
Vincent

  reply	other threads:[~2021-05-05 17:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 13:06 Vincent Donnefort
2021-05-05 14:04 ` Alexander Monakov
2021-05-05 17:05   ` Vincent Donnefort [this message]
2021-05-05 17:20   ` James Y Knight

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=20210505170506.GA260789@e120877-lin.cambridge.arm.com \
    --to=vincent.donnefort@arm.com \
    --cc=amonakov@ispras.ru \
    --cc=musl@lists.openwall.com \
    /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

mailing list of musl libc

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/musl

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 musl musl/ http://inbox.vuxu.org/musl \
		musl@inbox.vuxu.org
	public-inbox-index musl

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/musl/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git