linux/include
Pavel Emelyanov cf7b708c8d Make access to task's nsproxy lighter
When someone wants to deal with some other taks's namespaces it has to lock
the task and then to get the desired namespace if the one exists.  This is
slow on read-only paths and may be impossible in some cases.

E.g.  Oleg recently noticed a race between unshare() and the (sent for
review in cgroups) pid namespaces - when the task notifies the parent it
has to know the parent's namespace, but taking the task_lock() is
impossible there - the code is under write locked tasklist lock.

On the other hand switching the namespace on task (daemonize) and releasing
the namespace (after the last task exit) is rather rare operation and we
can sacrifice its speed to solve the issues above.

The access to other task namespaces is proposed to be performed
like this:

     rcu_read_lock();
     nsproxy = task_nsproxy(tsk);
     if (nsproxy != NULL) {
             / *
               * work with the namespaces here
               * e.g. get the reference on one of them
               * /
     } / *
         * NULL task_nsproxy() means that this task is
         * almost dead (zombie)
         * /
     rcu_read_unlock();

This patch has passed the review by Eric and Oleg :) and,
of course, tested.

[clg@fr.ibm.com: fix unshare()]
[ebiederm@xmission.com: Update get_net_ns_by_pid]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-19 11:53:37 -07:00
..
acpi
asm-alpha remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-arm remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-arm26 softlockup: make asm/irq_regs.h available on every platform 2007-10-17 08:42:47 -07:00
asm-avr32 remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-blackfin remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-cris remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-frv remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-generic bitops: introduce lock ops 2007-10-18 14:37:29 -07:00
asm-h8300 remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-ia64 remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-m32r remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-m68k remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-m68knommu remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-mips remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-parisc remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-powerpc remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-ppc Replace __attribute_pure__ with __pure 2007-10-18 14:37:32 -07:00
asm-s390 remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-sh remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-sh64 remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-sparc remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-sparc64 remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-um remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-v850 remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-x86 remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
asm-xtensa remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
crypto
keys KEYS: Make request_key() and co fundamentally asynchronous 2007-10-17 08:42:57 -07:00
linux Make access to task's nsproxy lighter 2007-10-19 11:53:37 -07:00
math-emu
media
mtd
net [IPSEC]: Rename mode to outer_mode and add inner_mode 2007-10-17 21:35:51 -07:00
pcmcia pcmcia: use DMA_MASK_NONE for the default for all pcmcia devices 2007-10-16 09:42:50 -07:00
rdma
rxrpc
scsi do not export /usr/include/scsi in make headers_install 2007-10-17 08:42:52 -07:00
sound [ALSA] version 1.0.15 2007-10-16 16:57:46 +02:00
video pm2fb: hardware cursor support for the Permedia2 2007-10-16 09:43:18 -07:00
xen xen: fix incorrect vcpu_register_vcpu_info hypercall argument 2007-10-16 11:51:31 -07:00
Kbuild do not export /usr/include/scsi in make headers_install 2007-10-17 08:42:52 -07:00