kprobes: No need to unlock kprobe_insn_mutex
authorMasami Hiramatsu <[email protected]>
Tue, 30 Jun 2009 21:08:09 +0000 (17:08 -0400)
committerIngo Molnar <[email protected]>
Wed, 1 Jul 2009 08:43:07 +0000 (10:43 +0200)
Remove needless kprobe_insn_mutex unlocking during safety check
in garbage collection, because if someone releases a dirty slot
during safety check (which ensures other cpus doesn't execute
all dirty slots), the safety check must be fail. So, we need to
hold the mutex while checking safety.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: Ananth N Mavinakayanahalli <[email protected]>
Cc: Jim Keniston <[email protected]>
Cc: Ananth N Mavinakayanahalli <[email protected]>
LKML-Reference: <20090630210809[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
kernel/kprobes.c

index c0fa54b276d951042f69febb6df8c27190850dd9..16b5739c516aa831d11755a93895f6b4d4e91001 100644 (file)
@@ -237,13 +237,9 @@ static int __kprobes collect_garbage_slots(void)
 {
        struct kprobe_insn_page *kip;
        struct hlist_node *pos, *next;
-       int safety;
 
        /* Ensure no-one is preepmted on the garbages */
-       mutex_unlock(&kprobe_insn_mutex);
-       safety = check_safety();
-       mutex_lock(&kprobe_insn_mutex);
-       if (safety != 0)
+       if (check_safety())
                return -EAGAIN;
 
        hlist_for_each_entry_safe(kip, pos, next, &kprobe_insn_pages, hlist) {