Skip to contentSkip to conversation

proc: less LOCK/UNLOCK in remove_proc_entry()

PATCH New Alexey Dobriyan 1 participant 1 message Nov 27, 2010 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: less LOCK/UNLOCK in remove_proc_entry()

For the common case, when proc entry is being removed and nobody is in the process of using it, save LOCK/UNLOCK pair.

---

 fs/proc/generic.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/proc/generic.c +1 -4
@@ -834,12 +834,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;