De-prioritizing a systemd-run job
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cpuset again. delay setting cgroup properties

rektide a83ab2be e75c8a40

+13 -3
+13 -3
gentle.sh
··· 136 136 mkdir -p "$TMPDIR" 137 137 OUTPUT_FILE=$(mktemp --tmpdir="$TMPDIR") 138 138 139 - # Launch systemd-run, tee stderr to file and also to terminal 140 - "${CMD[@]}" 2> >(tee "$OUTPUT_FILE" >&2) 141 - EXIT_CODE=$? 139 + # Launch systemd-run in background, tee stderr to file and also to terminal 140 + "${CMD[@]}" 2> >(tee "$OUTPUT_FILE" >&2) & 141 + RUN_PID=$! 142 + 143 + # Wait for scope to be created and systemd-run output to be captured 144 + sleep 0.3 142 145 143 146 # Read output and extract scope unit name from stderr 144 147 RUN_OUTPUT=$(cat "$OUTPUT_FILE") ··· 173 176 set_cgroup_property "io.weight" "default 1" "io.weight to minimum" 174 177 set_cgroup_property "io.prio.class" "idle" "io.prio.class to idle" 175 178 179 + # Set CPU affinity (AllowedCPUs property doesn't work, set cpuset directly) 180 + set_cgroup_property "cpuset.cpus" "$CPU_AFFINITY" "CPU affinity to $CPU_AFFINITY" 181 + 176 182 # Set CPU scheduling to batch via chrt (done pre-launch via CMD wrapping) 177 183 # Note: cpuset and scheduling policies are set via chrt -b 0 in command wrapper 178 184 # Post-launch cgroup does not support direct scheduling policy changes 179 185 fi 186 + 187 + # Wait for the background process to finish 188 + wait $RUN_PID 189 + EXIT_CODE=$? 180 190 181 191 # Clean up temporary file 182 192 rm -f "$OUTPUT_FILE"