diff --git a/core-cgroup-support-cpuset.patch b/core-cgroup-support-cpuset.patch index da4a52a..e4afb1e 100644 --- a/core-cgroup-support-cpuset.patch +++ b/core-cgroup-support-cpuset.patch @@ -5,8 +5,10 @@ Subject: [PATCH] core-cgroup: support cpuset This patch add support for cpuset subsystem. --- + meson.build | 2 + + meson_options.txt | 3 + src/basic/cgroup-util.c | 3 +- - src/basic/cgroup-util.h | 10 +- + src/basic/cgroup-util.h | 14 ++- src/basic/string-util.c | 42 +++++++ src/basic/string-util.h | 1 + src/core/cgroup.c | 112 ++++++++++++++---- @@ -26,8 +28,39 @@ This patch add support for cpuset subsystem. src/shared/cpu-set-util.c | 1 + src/test/test-cgroup-mask.c | 5 +- .../fuzz-unit-file/directives-all.service | 5 + - 21 files changed, 329 insertions(+), 73 deletions(-) + 23 files changed, 338 insertions(+), 73 deletions(-) +diff --git a/meson.build b/meson.build +index 7419e2b..614013b 100644 +--- a/meson.build ++++ b/meson.build +@@ -1578,6 +1578,7 @@ foreach term : ['analyze', + 'binfmt', + 'compat-mutable-uid-boundaries', + 'coredump', ++ 'cpuset-cgv1', + 'efi', + 'environment-d', + 'firstboot', +@@ -2853,6 +2854,7 @@ foreach tuple : [ + ['fexecve'], + ['standalone-binaries', get_option('standalone-binaries')], + ['coverage', get_option('b_coverage')], ++ ['cpuset-cgv1'], + ] + + if tuple.length() >= 2 +diff --git a/meson_options.txt b/meson_options.txt +index e708745..5fda5d9 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -514,3 +514,6 @@ option('bpf-compiler', type : 'combo', choices : ['clang', 'gcc'], + description: 'compiler used to build BPF programs') + option('bpf-framework', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' }, + description: 'build BPF programs from source code in restricted C') ++ ++option('cpuset-cgv1', type : 'boolean', value : 'true', ++ description : 'enable cgroup v1 cpuset support') diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 18b16ec..abd1f91 100644 --- a/src/basic/cgroup-util.c @@ -48,7 +81,7 @@ index 18b16ec..abd1f91 100644 [CGROUP_CONTROLLER_BPF_DEVICES] = "bpf-devices", [CGROUP_CONTROLLER_BPF_FOREIGN] = "bpf-foreign", diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h -index 6ab14c7..99be6b8 100644 +index 6ab14c7..dd3df28 100644 --- a/src/basic/cgroup-util.h +++ b/src/basic/cgroup-util.h @@ -22,12 +22,13 @@ typedef enum CGroupController { @@ -81,12 +114,16 @@ index 6ab14c7..99be6b8 100644 CGROUP_MASK_BPF_FIREWALL = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_BPF_FIREWALL), CGROUP_MASK_BPF_DEVICES = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_BPF_DEVICES), CGROUP_MASK_BPF_FOREIGN = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_BPF_FOREIGN), -@@ -62,10 +64,10 @@ typedef enum CGroupMask { +@@ -62,10 +64,14 @@ typedef enum CGroupMask { CGROUP_MASK_BPF_RESTRICT_NETWORK_INTERFACES = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_BPF_RESTRICT_NETWORK_INTERFACES), /* All real cgroup v1 controllers */ - CGROUP_MASK_V1 = CGROUP_MASK_CPU|CGROUP_MASK_CPUACCT|CGROUP_MASK_BLKIO|CGROUP_MASK_MEMORY|CGROUP_MASK_DEVICES|CGROUP_MASK_PIDS, -+ CGROUP_MASK_V1 = CGROUP_MASK_CPU|CGROUP_MASK_CPUACCT|CGROUP_MASK_BLKIO|CGROUP_MASK_MEMORY|CGROUP_MASK_CPUSET|CGROUP_MASK_DEVICES|CGROUP_MASK_PIDS, ++ CGROUP_MASK_V1 = CGROUP_MASK_CPU|CGROUP_MASK_CPUACCT|CGROUP_MASK_BLKIO|CGROUP_MASK_MEMORY|CGROUP_MASK_DEVICES|CGROUP_MASK_PIDS ++#if ENABLE_CPUSET_CGV1 ++ | CGROUP_MASK_CPUSET ++#endif ++ , /* All real cgroup v2 controllers */ - CGROUP_MASK_V2 = CGROUP_MASK_CPU|CGROUP_MASK_CPUSET|CGROUP_MASK_IO|CGROUP_MASK_MEMORY|CGROUP_MASK_PIDS, @@ -807,7 +844,7 @@ index 62112dc..de3f536 100644 { "Manager", "DefaultTasksMax", config_parse_tasks_max, 0, &arg_defaults.tasks_max }, { "Manager", "DefaultMemoryPressureThresholdSec", config_parse_sec, 0, &arg_defaults.memory_pressure_threshold_usec }, diff --git a/src/core/manager.c b/src/core/manager.c -index ce20d6b..03508c7 100644 +index ce20d6b..ef22fed 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -4192,6 +4192,7 @@ int manager_set_unit_defaults(Manager *m, const UnitDefaults *defaults) { @@ -949,5 +986,5 @@ index 4bdc48a..0e953f2 100644 CPUWeight= CapabilityBoundingSet= -- -2.33.0 +2.41.0 diff --git a/core-cgroup-support-freezer.patch b/core-cgroup-support-freezer.patch index 2a98422..0850851 100644 --- a/core-cgroup-support-freezer.patch +++ b/core-cgroup-support-freezer.patch @@ -5,8 +5,10 @@ Subject: [PATCH] core-cgroup: support freezer. This patch add support for freezer subsystem. --- + meson.build | 2 + + meson_options.txt | 3 ++ src/basic/cgroup-util.c | 1 + - src/basic/cgroup-util.h | 4 +- + src/basic/cgroup-util.h | 5 +++ src/core/cgroup.c | 16 +++++++ src/core/cgroup.h | 4 ++ src/core/dbus-cgroup.c | 29 +++++++++++++ @@ -24,9 +26,40 @@ This patch add support for freezer subsystem. src/test/test-cgroup-freezer.c | 43 +++++++++++++++++++ src/test/test-cgroup-mask.c | 3 +- .../fuzz-unit-file/directives-all.service | 2 + - 19 files changed, 157 insertions(+), 2 deletions(-) + 21 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 src/test/test-cgroup-freezer.c +diff --git a/meson.build b/meson.build +index 614013b..8712bdb 100644 +--- a/meson.build ++++ b/meson.build +@@ -1582,6 +1582,7 @@ foreach term : ['analyze', + 'efi', + 'environment-d', + 'firstboot', ++ 'freezer-cgv1', + 'gshadow', + 'hibernate', + 'hostnamed', +@@ -2855,6 +2856,7 @@ foreach tuple : [ + ['standalone-binaries', get_option('standalone-binaries')], + ['coverage', get_option('b_coverage')], + ['cpuset-cgv1'], ++ ['freezer-cgv1'], + ] + + if tuple.length() >= 2 +diff --git a/meson_options.txt b/meson_options.txt +index 5fda5d9..b61d99d 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -517,3 +517,6 @@ option('bpf-framework', type : 'feature', deprecated : { 'true' : 'enabled', 'fa + + option('cpuset-cgv1', type : 'boolean', value : 'true', + description : 'enable cgroup v1 cpuset support') ++ ++option('freezer-cgv1', type : 'boolean', value : 'true', ++ description : 'enable cgroup v1 freezer support') diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index abd1f91..3e60488 100644 --- a/src/basic/cgroup-util.c @@ -40,7 +73,7 @@ index abd1f91..3e60488 100644 [CGROUP_CONTROLLER_BPF_DEVICES] = "bpf-devices", [CGROUP_CONTROLLER_BPF_FOREIGN] = "bpf-foreign", diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h -index 99be6b8..eb7ace5 100644 +index dd3df28..4389cce 100644 --- a/src/basic/cgroup-util.h +++ b/src/basic/cgroup-util.h @@ -29,6 +29,7 @@ typedef enum CGroupController { @@ -59,15 +92,16 @@ index 99be6b8..eb7ace5 100644 CGROUP_MASK_BPF_FIREWALL = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_BPF_FIREWALL), CGROUP_MASK_BPF_DEVICES = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_BPF_DEVICES), CGROUP_MASK_BPF_FOREIGN = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_BPF_FOREIGN), -@@ -64,7 +66,7 @@ typedef enum CGroupMask { - CGROUP_MASK_BPF_RESTRICT_NETWORK_INTERFACES = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_BPF_RESTRICT_NETWORK_INTERFACES), +@@ -67,6 +69,9 @@ typedef enum CGroupMask { + CGROUP_MASK_V1 = CGROUP_MASK_CPU|CGROUP_MASK_CPUACCT|CGROUP_MASK_BLKIO|CGROUP_MASK_MEMORY|CGROUP_MASK_DEVICES|CGROUP_MASK_PIDS + #if ENABLE_CPUSET_CGV1 + | CGROUP_MASK_CPUSET ++#endif ++#if ENABLE_FREEZER_CGV1 ++ | CGROUP_MASK_FREEZER + #endif + , - /* All real cgroup v1 controllers */ -- CGROUP_MASK_V1 = CGROUP_MASK_CPU|CGROUP_MASK_CPUACCT|CGROUP_MASK_BLKIO|CGROUP_MASK_MEMORY|CGROUP_MASK_CPUSET|CGROUP_MASK_DEVICES|CGROUP_MASK_PIDS, -+ CGROUP_MASK_V1 = CGROUP_MASK_CPU|CGROUP_MASK_CPUACCT|CGROUP_MASK_BLKIO|CGROUP_MASK_MEMORY|CGROUP_MASK_CPUSET|CGROUP_MASK_FREEZER|CGROUP_MASK_DEVICES|CGROUP_MASK_PIDS, - - /* All real cgroup v2 controllers */ - CGROUP_MASK_V2 = CGROUP_MASK_CPU|CGROUP_MASK_CPUSET2|CGROUP_MASK_IO|CGROUP_MASK_MEMORY|CGROUP_MASK_PIDS, diff --git a/src/core/cgroup.c b/src/core/cgroup.c index cd1e97d..3e47f76 100644 --- a/src/core/cgroup.c @@ -314,7 +348,7 @@ index de3f536..96b0a11 100644 { "Manager", "DefaultTasksMax", config_parse_tasks_max, 0, &arg_defaults.tasks_max }, { "Manager", "DefaultMemoryPressureThresholdSec", config_parse_sec, 0, &arg_defaults.memory_pressure_threshold_usec }, diff --git a/src/core/manager.c b/src/core/manager.c -index 03508c7..3d14ea1 100644 +index ef22fed..b29d4e1 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -4193,6 +4193,7 @@ int manager_set_unit_defaults(Manager *m, const UnitDefaults *defaults) { @@ -496,5 +530,5 @@ index 0e953f2..123c98e 100644 GuessMainPID= IOAccounting= -- -2.33.0 +2.41.0 diff --git a/systemd.spec b/systemd.spec index 755ddfb..d6d0d6f 100644 --- a/systemd.spec +++ b/systemd.spec @@ -25,7 +25,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 255 -Release: 2 +Release: 3 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -292,6 +292,9 @@ Systemd PAM module registers the session with systemd-logind. %prep %autosetup -n %{name}-%{version} -p1 -Sgit +%ifnarch sw_64 +%patch 9036 -R -p1 +%endif %build @@ -1627,6 +1630,10 @@ fi %{_libdir}/security/pam_systemd_loadkey.so %changelog +* Wed Feb 28 2024 huyubiao - 255-3 +- 1.add cpuset-cgv1 and freezer-cgv1 macros and enabled by default + 2.add missing sw_64 macro in prep phase + * Sun Feb 18 2024 huyubiao - 255-2 - allow underscore in hostname