Commit graph

19 commits

Author SHA1 Message Date
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Michal Sekletár e2b2fb7f56 core: add support for setting CPUAffinity= to special "numa" value
systemd will automatically derive CPU affinity mask from NUMA node
mask.

Fixes #13248
2020-03-16 08:57:28 +01:00
Zbigniew Jędrzejewski-Szmek 64412970ac test-cpu-set-util: fix allocation size check on i386
We get just 28 bytes not 32 as on 64-bit architectures (__cpu_set_t is 4 bytes,
we need at least 26, so 28 satisfies the constraints).
2019-06-04 09:40:38 +02:00
Zbigniew Jędrzejewski-Szmek a299ce058b test-cpu-set-util: fix comparison for allocation size
On i386, __cpu_mask is 4 bytes, so we'd check if c.allocated >= 0, and
gcc would warn about a bogus comparison. Let's round up.

Fixes #12726.
2019-06-04 09:23:34 +02:00
Michal Sekletar 71923237b1 cpu-set-util: use %d-%d format in cpu_set_to_range_string() only for actual ranges 2019-06-03 22:36:58 +02:00
Zbigniew Jędrzejewski-Szmek 1f57a176af shared/cpu-set-util: only force range printing one time
The idea is to have at least one range to make the new format clearly
distinguishable from the old. But it is enough to just do it once.
In particular, in case the affinity would be specified like 0, 2, 4, 6…,
this gives much shorter output.
2019-05-29 17:02:24 +02:00
Michal Sekletar 71b28519b5 shared/cpu-set-util: introduce cpu_set_to_range() 2019-05-29 17:02:21 +02:00
Zbigniew Jędrzejewski-Szmek 1bf0d6c28f test-cpu-set-util: add test for dbus conversions 2019-05-29 16:54:49 +02:00
Zbigniew Jędrzejewski-Szmek b54d7241f2 test-cpu-set-util: add a smoke test for test_parse_cpu_set_extend() 2019-05-29 10:29:24 +02:00
Zbigniew Jędrzejewski-Szmek 9d1345f065 test-cpu-set-util: add simple test for cpus_in_affinity_mask() 2019-05-29 10:28:11 +02:00
Zbigniew Jędrzejewski-Szmek 0985c7c4e2 Rework cpu affinity parsing
The CPU_SET_S api is pretty bad. In particular, it has a parameter for the size
of the array, but operations which take two (CPU_EQUAL_S) or even three arrays
(CPU_{AND,OR,XOR}_S) still take just one size. This means that all arrays must
be of the same size, or buffer overruns will occur. This is exactly what our
code would do, if it received an array of unexpected size over the network.
("Unexpected" here means anything different from what cpu_set_malloc() detects
as the "right" size.)

Let's rework this, and store the size in bytes of the allocated storage area.

The code will now parse any number up to 8191, independently of what the current
kernel supports. This matches the kernel maximum setting for any architecture,
to make things more portable.

Fixes #12605.
2019-05-29 10:20:42 +02:00
Zbigniew Jędrzejewski-Szmek a832893f9c shared/cpu-set-util: move the part to print cpu-set into a separate function
Also avoid unnecessary asprintf() when we can write to the output area
directly.
2019-05-21 08:44:03 +02:00
Lennart Poettering 0c69794138 tree-wide: remove Lennart's copyright lines
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
2018-06-14 10:20:20 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Yu Watanabe da681e1bd2 tree-wide: use cpu_set_mfree() 2017-12-06 10:32:38 +09:00
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Jan Synacek efd0802231 test-cpu-set-util.c: fix typo in comment (#6916) 2017-09-26 13:50:31 +02:00
Ronny Chevalier 7ba365a9b2 tests: move cpu-set-util related tests to test-cpu-set-util.c 2016-03-03 18:46:58 +01:00