Re: [PATCH 1/1] rseq.2: New man page for the rseq(2) API

From: Mathieu Desnoyers
Date: Wed Feb 15 2023 - 12:12:59 EST


On 2023-02-15 12:09, Mathieu Desnoyers wrote:
On 2023-02-14 20:20, G. Branden Robinson wrote:
[...]

+user-space performs any side-effect
+(e.g. storing to memory).
+.IP
+This field is always guaranteed to hold a valid CPU number in the range
+[ 0 ..  nr_possible_cpus - 1 ].

Please use interval notation:
    [0, nr_possible_cpus)
or
    [0, nr_possible_cpus - 1]
whichever looks better to you.

We did some consistency fix recently:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=147a60d792a5db8f3cb93ea16eefb73e16c1fb91>

Also, do we have a more standard way of saying nr_possible_cpus?
Should we say nproc?

nproc(1) means:

       Print  the number of processing units available to the current
       process, which may be less than the number of online processors

Which is the number of cpus currently available (AFAIU the result of the
cpuset and sched affinity).

What I really mean here is the maximum value for possible cpus which can be hotplugged into the system. So it's not the maximum number of possible CPUs per se, but rather the maximum enabled bit in the possible CPUs mask.

Note that we could express this differently as well: rather than saying that it guarantees a value in the range [0, nr_possible_cpus - 1], we could say that the values are guaranteed to be part of the possible cpus mask, which would actually more accurate in case the possible cpus mask has a hole (it tends to happen with things like lxc containers nowadays).

Do you agree that we should favor expressing this in terms of belonging to the possible cpumask set rather than a range starting from 0 ?

Actually, the field may contain the value 0 even if 0 is not part of the possible cpumask. So forget what I just said about being guaranteed to be part of the possible cpus mask.

Thoughts ?

Thanks,

Mathieu


Thanks,

Mathieu


--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com