oom: add unit file settings for oomd avoid/omit xattrs

This commit is contained in:
Anita Zhang
2021-01-28 02:31:44 -08:00
parent 59331b8e29
commit 4e806bfa9f
11 changed files with 94 additions and 10 deletions

View File

@@ -138,6 +138,10 @@ MakeDirectory=
Mark=
MaxConnections=
MaxConnectionsPerSource=
ManagedOOMSwap=
ManagedOOMMemoryPressure=
ManagedOOMMemoryPressureLimitPercent=
ManagedOOMPreference=
MemoryAccounting=
MemoryHigh=
MemoryLimit=

View File

@@ -13,6 +13,8 @@ if [[ "$cgroup_type" != *"cgroup2"* ]] && [[ "$cgroup_type" != *"0x63677270"* ]]
fi
[[ -e /skipped ]] && exit 0 || true
rm -rf /etc/systemd/system/testsuite-56-testbloat.service.d
echo "DefaultMemoryPressureDurationSec=5s" >> /etc/systemd/oomd.conf
systemctl start testsuite-56-testchill.service
@@ -41,10 +43,14 @@ if ! systemctl status testsuite-56-testchill.service; then exit 24; fi
if setfattr -n user.xattr_test -v 1 /sys/fs/cgroup/; then
sleep 120 # wait for systemd-oomd kill cool down and elevated memory pressure to come down
mkdir -p /etc/systemd/system/testsuite-56-testbloat.service.d/
echo "[Service]" > /etc/systemd/system/testsuite-56-testbloat.service.d/override.conf
echo "ManagedOOMPreference=avoid" >> /etc/systemd/system/testsuite-56-testbloat.service.d/override.conf
systemctl daemon-reload
systemctl start testsuite-56-testchill.service
systemctl start testsuite-56-testmunch.service
systemctl start testsuite-56-testbloat.service
setfattr -n user.oomd_avoid -v 1 /sys/fs/cgroup/testsuite.slice/testsuite-56.slice/testsuite-56-workload.slice/testsuite-56-testbloat.service
timeout=$(date -ud "2 minutes" +%s)
while [[ $(date -u +%s) -le $timeout ]]; do