[PATCH] vfs: Speed up deactivate_super for non-modular filesystems
From: Eric W. Biederman
Date: Mon May 07 2012 - 17:51:25 EST
Recently it was observed that a distilled version of vsftp was taking a
surprising amount of time reaping zombies. A measurement was taken
and vsftp was taking about 4ms (one jiffie) to reap each zombie and
those 4ms were spent spleeping in rcu_barrier in deactivate_locked_super.
The reason vsftp was sleeping in deactivate_locked_super is because
vsftp creates a pid namespace for each connection, and with that
pid namespace comes an internal mount of /proc. That internal mount
of proc is unmounted when the last process in the pid namespace is
reaped.
/proc and similar non-modular filesystems do not need a rcu_barrier
in deactivate_locked_super. Being non-modular there is no danger
of the rcu callback running after the module is unloaded.
Therefore do the easy thing and remove 4ms+ from unmount times by only
calling rcu_barrier for modular filesystems in unmount.
Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
---
fs/super.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/super.c b/fs/super.c
index cf00177..c739ef8 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -261,7 +261,8 @@ void deactivate_locked_super(struct super_block *s)
* We need to call rcu_barrier so all the delayed rcu free
* inodes are flushed before we release the fs module.
*/
- rcu_barrier();
+ if (fs->owner)
+ rcu_barrier();
put_filesystem(fs);
put_super(s);
} else {
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/