-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Description
Submission type
- Request for enhancement (RFE)
systemd version the issue has been seen with
code seen in master
Used distribution
Fedora
RFE
I've been overloading my RAM a bit lately.
StackOverflow has a one-liner to print per-process swap usage. I notice that (sd-pam) can end up with more swap accounted than the parent systemd currently has. Like, almost 2MB!
This is basically all going to be dead memory as far as (sd-pam) is concerned. I think it's got to be copy-on-write pages from PID 1.
If the parent is also modifying memory while the child runs, the child will be hosting copies of all the modified memory (copy-on-write). Often the child is performing a sub-task and only uses a subset of that data.
It's possible for it to be significant with a larger parent process and longer-running child process.
$ (echo "COMM PID SWAP"; for file in /proc/*/status ; do awk '/^Pid|VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | grep kB | grep -wv "0 kB" | sort -k 3 -n -r) | column -t | grep -E 'sys|[(]'
systemd-udevd 586 4436 kB
(sd-pam) 2215 3900 kB
(sd-pam) 1023 3896 kB
(sd-pam) 17506 2488 kB
systemd 1 2260 kB
systemd-logind 840 960 kB
systemd 1007 748 kB
systemd-journal 560 656 kB
systemd 2210 652 kB