test/scheduler: Create unique list of existing cgroups prior moving them

Since multiple processes may belong to the same cgroup, this will
make sure we don't call move_cgroup_procs() against single cgroup
multiple times.

Signed-off-by: Michal Berger <michallinuxstuff@gmail.com>
Change-Id: I64d12e5ac8e9c628ff7556b566f2090c965ab35a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11671
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Michal Berger 2022-02-18 12:19:17 +01:00 committed by Tomasz Zawadzki
parent f8f9b01d97
commit a9614bf6e7

View File

@ -12,6 +12,7 @@ check_cgroup() {
init_cpuset_cgroup() {
local cgroup
local -A cgroups=()
# For cgroup-v2 we need to prepare cpuset subsystem on our own
if ((cgroup_version == 2)); then
@ -29,8 +30,11 @@ init_cpuset_cgroup() {
cgroup=$(< "$cgroup") || continue
cgroup=${cgroup##*:}
[[ $cgroup != / ]] || continue
move_cgroup_procs "${cgroup##*:}" /
cgroups["$cgroup"]=$cgroup
done 2> /dev/null
for cgroup in "${!cgroups[@]}"; do
move_cgroup_procs "$cgroup" /
done
# Now, move all the threads to the cpuset
move_cgroup_procs / /cpuset
elif ((cgroup_version == 1)); then