]> git.baikalelectronics.ru Git - kernel.git/commit
namespaces: Use task_lock and not rcu to protect nsproxy
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 4 Feb 2014 03:13:49 +0000 (19:13 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 30 Jul 2014 01:08:50 +0000 (18:08 -0700)
commit37fd8779e1503e8bdfff25d1d6916d3bdfb6294a
tree26f69d0fe363f00b628d698b9df2634a33e42482
parentf47b9824ee6f6b309b2081f5eb442a9bd6ee9846
namespaces: Use task_lock and not rcu to protect nsproxy

The synchronous syncrhonize_rcu in switch_task_namespaces makes setns
a sufficiently expensive system call that people have complained.

Upon inspect nsproxy no longer needs rcu protection for remote reads.
remote reads are rare.  So optimize for same process reads and write
by switching using rask_lock instead.

This yields a simpler to understand lock, and a faster setns system call.

In particular this fixes a performance regression observed
by Rafael David Tinoco <rafael.tinoco@canonical.com>.

This is effectively a revert of Pavel Emelyanov's commit
fe5a2b30ab1b9f1a2a419a69295b670f835321ae Make access to task's nsproxy lighter
from 2007.  The race this originialy fixed no longer exists as
do_notify_parent uses task_active_pid_ns(parent) instead of
parent->nsproxy.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
fs/namespace.c
fs/proc/proc_net.c
fs/proc_namespace.c
include/linux/nsproxy.h
ipc/namespace.c
kernel/nsproxy.c
kernel/utsname.c
net/core/net_namespace.c