]> git.ipfire.org Git - thirdparty/systemd.git/commit
core/mount: minimize impact on mount storm.
authorNeilBrown <neilb@suse.com>
Thu, 4 Oct 2018 05:49:22 +0000 (15:49 +1000)
committerLennart Poettering <lennart@poettering.net>
Sun, 16 Dec 2018 11:38:40 +0000 (12:38 +0100)
commit89f9752ea08f516b5d77f8e577bb772073c70c01
treeba50cc1133b37d85da63dda234971a475833ccb5
parent2d41e9b7a0d5697bf93eec1a82dc0a91135b256e
core/mount: minimize impact on mount storm.

If we create 2000 mounts (on a 1-CPU qemu VM) with
  mkdir -p /MNT/{1..2000}
  time for i in {1..2000}; do mount --bind /etc /MNT/$i ; done

it takes around 20 seconds to complete.  Much of this time is taken up
by systemd repeatedly processing /proc/self/mountinfo.
If I disable the processing, the time drops to about 4 seconds.

I have reports that on a larger system with multiple active user sessions, each
with it's own systemd, the impact can be higher.

One particular use-case where a large number of mounts can be expected in quick
succession is when the "clearcase" SCM starts up.

This patch modifies the handling up events from /proc/self/mountinfo so
that systemd backs off when a storm is detected.  Specifically the time to process
mountinfo is measured, and the process will not be repeated until 10 times
that duration has passed.  This ensures systemd won't use more than 10% of
real time processing mountinfo.

With this patch, my test above takes about 5 seconds.
src/core/manager.h
src/core/mount.c