diff options
author | Waiman Long <Waiman.Long@hp.com> | 2015-07-11 00:19:56 +0300 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2015-07-13 20:31:59 +0300 |
commit | 9629d04ae06812f217846b69728c969afee690b4 (patch) | |
tree | 27a52f6f1744c528b10e3b923ee381264c08b540 /fs/reiserfs/dir.c | |
parent | fa1aa143ac4a682c7f5fd52a3cf05f5a6fe44a0a (diff) | |
download | linux-9629d04ae06812f217846b69728c969afee690b4.tar.xz |
selinux: reduce locking overhead in inode_free_security()
The inode_free_security() function just took the superblock's isec_lock
before checking and trying to remove the inode security struct from the
linked list. In many cases, the list was empty and so the lock taking
is wasteful as no useful work is done. On multi-socket systems with
a large number of CPUs, there can also be a fair amount of spinlock
contention on the isec_lock if many tasks are exiting at the same time.
This patch changes the code to check the state of the list first before
taking the lock and attempting to dequeue it. The list_del_init()
can be called more than once on the same list with no harm as long
as they are properly serialized. It should not be possible to have
inode_free_security() called concurrently with list_add(). For better
safety, however, we use list_empty_careful() here even though it is
still not completely safe in case that happens.
Signed-off-by: Waiman Long <Waiman.Long@hp.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'fs/reiserfs/dir.c')
0 files changed, 0 insertions, 0 deletions