systemd-oomd doesn't care about the slices other than user slice, it's why the sshd won't be killed but it also use a lot of memory:
/sys/fs/cgroup/user.slice/user-1001.slice/session-4.scope/memory.pressure some avg10=69.94 avg60=69.56 avg300=43.64 total=202010660 full avg10=69.07 avg60=68.73 avg300=43.07 total=199371697 Tue Aug 16 03:32:11 PM CST 2022 Dry Run: no Swap Used Limit: 90.00% Default Memory Pressure Limit: 60.00% Default Memory Pressure Duration: 20s System Context: Memory: Used: 3.5G Total: 3.5G Swap: Used: 1.9G Total: 1.9G Swap Monitored CGroups: Memory Pressure Monitored CGroups: Path: /user.slice/user-1001.slice/user@1001.service Memory Pressure Limit: 50.00% Pressure: Avg10: 25.40 Avg60: 24.64 Avg300: 12.24 Total: 1min 15s Current Memory Usage: 74.5M Memory Min: 0B Memory Low: 0B Pgscan: 24554223 Last Pgscan: 24533954 --- only user@1001.service in monitoring score. -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/1985887 Title: systemd kills gnome-shell or gnome-terminal if gnome-terminal uses much memory (50% over 20s) Status in OEM Priority Project: Confirmed Status in systemd package in Ubuntu: New Bug description: [Steps to reproduce] 0. Install Jammy image 1. open gnome terminal 2. issue stress_ng or Canonical certification tool checkbox as "checkbox-cli run com.canonical.certification::memory/memory_stress_ng" or "stress-ng --stack 0 --timeout 300" 3. Terminal or Gnome-shell will be killed by systemd-oomd It's because all stressors are under same cgroup belongs to terminal. Both Wayland and Xorg can reproduce. over ssh and in multi-user.target work good. To manage notifications about this bug go to: https://bugs.launchpad.net/oem-priority/+bug/1985887/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp