proc: less LOCK/UNLOCK in remove_proc_entry()
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 13 Jan 2011 01:00:35 +0000 (17:00 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Jan 2011 16:03:17 +0000 (08:03 -0800)
For the common case where a proc entry is being removed and nobody is in
the process of using it, save a LOCK/UNLOCK pair.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/generic.c

index d00c5af6f1990d8a00d93cb3217e8daead81b75f..01e07f2a188fb0d58686d14b36e63e02b7dea08b 100644 (file)
@@ -826,12 +826,9 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
 
                wait_for_completion(de->pde_unload_completion);
 
-               goto continue_removing;
+               spin_lock(&de->pde_unload_lock);
        }
-       spin_unlock(&de->pde_unload_lock);
 
-continue_removing:
-       spin_lock(&de->pde_unload_lock);
        while (!list_empty(&de->pde_openers)) {
                struct pde_opener *pdeo;