]> git.baikalelectronics.ru Git - kernel.git/commit
shm: optimize exit_shm()
authorVasiliy Kulikov <segoon@openwall.com>
Wed, 3 Aug 2011 18:28:26 +0000 (22:28 +0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 4 Aug 2011 00:45:55 +0000 (14:45 -1000)
commit3267cc5fb6f7e9e81093dda952b82e84bcdc1e7f
tree15861e6610403c57cf4eca976dea4d59ac7a8e99
parentada82c711699d8cc9df6396da27d44a75360a301
shm: optimize exit_shm()

We may optimistically check .in_use == 0 without holding the rw_mutex:
it's the common case, and if it's zero, there certainly won't be any
segments associated with us.

After taking the lock, the idr_for_each() will do the right thing, so we
could now drop the re-check inside the lock without any real cost.  But
it won't hurt.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ipc/shm.c