On 25/07/2026 13:39, Bruno Haible wrote:
Pádraig Brady wrote:
That probably makes sense. I'm quite surprised with the systemd runtime 
overhead:

     $ strace -c /bin/who 2>&1 | grep total
     100.00    0.003110           6       459        15 total

     $ strace -c git/coreutils/src/who 2>&1 | grep total
     100.00    0.000000           0       140         8 total

My main point here is that the systemd variant had over 3x the number of 
syscalls.

Indeed, libsystemd appears to read the per-session files multiple times,
and there are also many redundant fstat() calls:

$ strace 9.11-systemd/bin/who


For general info,
I also notice these extra systemd calls from ls,
even though it doesn't link directly with systemd!
It's coming from user db lookup which connects to systemd
(over polled sockets) though nss config.

You can see the difference between the default:

  $ sudo strace -c /bin/ls -ld / 2>&1 | grep total
  100.00    0.000488           2       179        17 total

and with systemd disabled in nss:

  $ sed 's/systemd//' /etc/nsswitch.conf > /tmp/nsswitch-nosystemd.conf
  $ sudo unshare -m -- bash -c '
    mount --bind /tmp/nsswitch-nosystemd.conf /etc/nsswitch.conf
  strace -c /bin/ls -ld /' 2>&1 | grep total
  100.00    0.000614           4       146        17 total

Now systemd is providing support for DynamicUser=, homed, or nspawn containers
but it's unfortunate that it's quite heavy weight for all users
even with basic command like ls.

cheers,
Padraig

Reply via email to