summaryrefslogtreecommitdiffstats
path: root/src/shared/cpu-set-util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* various: move ptr indicator to return valueZbigniew Jędrzejewski-Szmek2024-06-191-1/+1
|
* udevd: Add ReceivePacketSteeringCPUMask for systemd.linkRenjaya Raga Zenta2024-02-281-0/+77
| | | | | | | | | | | | | | | | Takes a list of CPU indices or ranges separated by either whitespace or commas. Alternatively, takes the special value "all" in which will include all available CPUs in the mask. CPU ranges are specified by the lower and upper CPU indices separated by a dash (e.g. "2-6"). This option may be specified more than once, in which case the specified CPU affinity masks are merged. If an empty string is assigned, the mask is reset, all assignments prior to this will have no effect. Defaults to unset and RPS CPU list is unchanged. To disable RPS when it was previously enabled, use the special value "disable". Currently, this will set CPU mask to all `rx` queue of matched device (if it has multiple queues). The `/sys/class/net/<dev>/queues/rx-<n>/rps_cpus` only accept cpu bitmap mask in hexadecimal. Fix: #30323
* tree-wide: add some assertsDavid Tardon2023-04-141-0/+4
|
* tree-wide: use TAKE_STRUCTDavid Tardon2023-04-141-7/+3
|
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-3/+1
|
* tree-wide: Use correct format specifiersJan Janssen2022-08-301-4/+4
| | | | gcc will complain about all these with -Wformat-signedness.
* alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()Lennart Poettering2021-05-191-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | We recently started making more use of malloc_usable_size() and rely on it (see the string_erase() story). Given that we don't really support sytems where malloc_usable_size() cannot be trusted beyond statistics anyway, let's go fully in and rework GREEDY_REALLOC() on top of it: instead of passing around and maintaining the currenly allocated size everywhere, let's just derive it automatically from malloc_usable_size(). I am mostly after this for the simplicity this brings. It also brings minor efficiency improvements I guess, but things become so much nicer to look at if we can avoid these allocation size variables everywhere. Note that the malloc_usable_size() man page says relying on it wasn't "good programming practice", but I think it does this for reasons that don't apply here: the greedy realloc logic specifically doesn't rely on the returned extra size, beyond the fact that it is equal or larger than what was requested. (This commit was supposed to be a quick patch btw, but apparently we use the greedy realloc stuff quite a bit across the codebase, so this ends up touching *a*lot* of code.)
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* core: introduce support for setting NUMAMask= to special "all" valueMichal Sekletár2020-09-081-1/+1
| | | | Fixes #14113
* core: add support for setting CPUAffinity= to special "numa" valueMichal Sekletár2020-03-161-2/+2
| | | | | | | systemd will automatically derive CPU affinity mask from NUMA node mask. Fixes #13248
* shared: split out NUMA code from cpu-set-util.c to numa-util.cMichal Sekletár2020-03-161-87/+0
|
* Rename EXTRACT_QUOTES to EXTRACT_UNQUOTEZbigniew Jędrzejewski-Szmek2019-06-281-1/+1
| | | | | | Whenever I see EXTRACT_QUOTES, I'm always confused whether it means to leave the quotes in or to take them out. Let's say "unquote", like we say "cunescape".
* core: introduce NUMAPolicy and NUMAMask optionsMichal Sekletar2019-06-241-0/+93
| | | | | | | | | | | | | Make possible to set NUMA allocation policy for manager. Manager's policy is by default inherited to all forked off processes. However, it is possible to override the policy on per-service basis. Currently we support, these policies: default, prefer, bind, interleave, local. See man 2 set_mempolicy for details on each policy. Overall NUMA policy actually consists of two parts. Policy itself and bitmask representing NUMA nodes where is policy effective. Node mask can be specified using related option, NUMAMask. Default mask can be overwritten on per-service level.
* cpu-set-util: use %d-%d format in cpu_set_to_range_string() only for actual ↵Michal Sekletar2019-06-031-2/+2
| | | | ranges
* shared/cpu-set-util: only force range printing one timeZbigniew Jędrzejewski-Szmek2019-05-291-2/+8
| | | | | | | 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.
* shared/cpu-set-util: introduce cpu_set_to_range()Michal Sekletar2019-05-291-0/+37
|
* shared/cpu-set-util: make transfer of cpu_set_t over bus endian safeMichal Sekletar2019-05-291-0/+38
|
* test-execute: use CPUSet tooZbigniew Jędrzejewski-Szmek2019-05-291-30/+1
| | | | | | cpu_set_malloc() was the last user. It doesn't seem useful to keep it just to save the allocation of a few hundred bytes in a test, so it is dropped and a fixed maximum is allocated (1024 bytes).
* Move cpus_in_affinity_mask() to cpu-set-util.[ch]Zbigniew Jędrzejewski-Szmek2019-05-291-0/+34
| | | | | It just seems to fit better there and it's always better to have things in shared/ rather than basic/.
* Rework cpu affinity parsingZbigniew Jędrzejewski-Szmek2019-05-291-25/+108
| | | | | | | | | | | | | | | | | | 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.
* shared/cpu-set-util: move the part to print cpu-set into a separate functionZbigniew Jędrzejewski-Szmek2019-05-211-0/+21
| | | | | Also avoid unnecessary asprintf() when we can write to the output area directly.
* Move various files that don't need to be in basic/ to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-0/+99
This doesn't have much effect on the final build, because we link libbasic.a into libsystemd-shared.so, so in the end, all the object built from basic/ end up in libsystemd-shared. And when the static library is linked into binaries, any objects that are included in it but are not used are trimmed. Hence, the size of output artifacts doesn't change: $ du -sb /var/tmp/inst* 54181861 /var/tmp/inst1 (old) 54207441 /var/tmp/inst1s (old split-usr) 54182477 /var/tmp/inst2 (new) 54208041 /var/tmp/inst2s (new split-usr) (The negligible change in size is because libsystemd-shared.so is bigger by a few hundred bytes. I guess it's because symbols are named differently or something like that.) The effect is on the build process, in particular partial builds. This change effectively moves the requirements on some build steps toward the leaves of the dependency tree. Two effects: - when building items that do not depend on libsystemd-shared, we build less stuff for libbasic.a (which wouldn't be used anyway, so it's a net win). - when building items that do depend on libshared, we reduce libbasic.a as a synchronization point, possibly allowing better parallelism. Method: 1. copy list of .h files from src/basic/meson.build to /tmp/basic 2. $ for i in $(grep '.h$' /tmp/basic); do echo $i; git --no-pager grep "include \"$i\"" src/basic/ 'src/lib*' 'src/nss-*' 'src/journal/sd-journal.c' |grep -v "${i%.h}.c";echo ;done | less