From: Vasiliy Kulikov Date: Thu, 28 Jul 2011 23:56:40 +0000 (+0400) Subject: shm: optimize locking and ipc_namespace getting X-Git-Tag: v3.1-rc1~111 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c677e2eefdba9c5bfc4474e2e91b26ae8458a1d;p=pandora-kernel.git shm: optimize locking and ipc_namespace getting shm_lock() does a lookup of shm segment in shm_ids(ns).ipcs_idr, which is redundant as we already know shmid_kernel address. An actual lock is also not required for reads until we really want to destroy the segment. exit_shm() and shm_destroy_orphaned() may avoid the loop by checking whether there is at least one segment in current ipc_namespace. The check of nsproxy and ipc_ns against NULL is redundant as exit_shm() is called from do_exit() before the call to exit_notify(), so the dereferencing current->nsproxy->ipc_ns is guaranteed to be safe. Reported-by: Oleg Nesterov Signed-off-by: Vasiliy Kulikov Acked-by: Serge Hallyn Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed