4

Taking for example this hierarchy from systemd-cgls:

└─user.slice
  ├─user-1000.slice
  │ ├─user@1000.service
  │ │ └─init.scope
  │ │   ├─3262 /lib/systemd/systemd --user
  │ │   └─3263 (sd-pam)  
  │ └─session-3.scope
  │   ├─3260 sshd: user1 [priv]
  │   ├─3362 sshd: user1@pts/1 
  │   ├─3363 -bash
  │   └─3378 ssh-agent -s
  └─user-0.slice
    ├─session-1.scope
    │ ├─3151 sshd: root@pts/0    
    │ ├─3252 -bash
    │ ├─3625 systemd-cgls

If I set a limit for user.slice, for example 5M of memory, the Memory line clearly report it:

systemctl status user.slice
● user.slice
   Loaded: loaded (/etc/systemd/system/user.slice; static; vendor preset: enabled)
   Active: active since Mon 2016-08-22 11:32:13 CEST; 52min ago
    Tasks: 12
   Memory: 3.1M (limit: 5.0M)
      CPU: 1.275s
   CGroup: /user.slice
...

The user-1000 slice have the limit applied, if I stress the system with this user I can see it. But the status don't report the limit in this child slice:

systemctl status user-1000.slice
● user-1000.slice - User Slice of user1
   Loaded: loaded (/run/systemd/transient/user-1000.slice; transient; vendor preset: enabled)
Transient: yes
   Active: active since Mon 2016-08-22 11:32:42 CEST; 1h 8min ago
    Tasks: 6 (limit: 12288)
   Memory: 856.0K
      CPU: 521ms

Following the proc way I can see that the user-1000 process belong to the user slice:

# cat /proc/3260/cgroup 
10:memory:/user.slice/user-1000.slice
...

And checking directly inside the /sys/:

root@server1:/sys/fs/cgroup/memory/user.slice# cat memory.limit_in_bytes 
5242880
root@server1:/sys/fs/cgroup/memory/user.slice# cd user-1000.slice/
root@server1:/sys/fs/cgroup/memory/user.slice/user-1000.slice# cat memory.limit_in_bytes 
9223372036854771712

How is possible to know if a child process/slice have a limit defined in a parent cgroup?

rfmoz
  • 694
  • 9
  • 15

0 Answers0