Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 5 May 2021 18:05:06 +0100
From: Vincent Donnefort <vincent.donnefort@....com>
To: Alexander Monakov <amonakov@...ras.ru>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] sysconf: add _SC_NPROCESSORS_CONF support

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.