]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: cpuset: centralize a reliable bound cpu detection
authorWilly Tarreau <w@1wt.eu>
Tue, 11 Jul 2023 14:51:22 +0000 (16:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 4 Sep 2023 17:39:17 +0000 (19:39 +0200)
commite65f54cf96725eeb2bc757cde6bd053152a3eef5
tree583573b55742870af6d3853ac6c0dc536a9a3fcd
parentd3ecc67a01c9021eedc9501e0fbfda1991f377a5
MINOR: cpuset: centralize a reliable bound cpu detection

Till now the CPUs that were bound were only retrieved in
thread_cpus_enabled() in order to count the number of CPUs allowed,
and it relied on arch-specific code.

Let's slightly arrange this into ha_cpuset_detect_bound() that
reuses the ha_cpuset struct and the accompanying code. This makes
the code much clearer without having to carry along some arch-specific
stuff out of this area.

Note that the macos-specific code used in thread.c to only count
online CPUs but not retrieve a mask, so for now we can't infer
anything from it and can't implement it.

In addition and more importantly, this function is reliable in that
it will only return a value when the detection is accurate, and will
not return incomplete sets on operating systems where we don't have
an exact list, such as online CPUs.
include/haproxy/cpuset.h
src/cpuset.c