[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <159593934624.4006.4213436208654596958.tip-bot2@tip-bot2>
Date: Tue, 28 Jul 2020 12:29:06 -0000
From: "tip-bot2 for Masami Hiramatsu" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Ingo Molnar <mingo@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
x86 <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: [tip: perf/core] kprobes: Remove unnecessary module_mutex locking
from kprobe_optimizer()
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 112a0e4171e111e963aada3fe790c71accf4d705
Gitweb: https://git.kernel.org/tip/112a0e4171e111e963aada3fe790c71accf4d705
Author: Masami Hiramatsu <mhiramat@...nel.org>
AuthorDate: Tue, 28 Jul 2020 16:34:00 +09:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Tue, 28 Jul 2020 13:19:05 +02:00
kprobes: Remove unnecessary module_mutex locking from kprobe_optimizer()
Since we already lock both kprobe_mutex and text_mutex in the optimizer,
text will not be changed and the module unloading will be stopped
inside kprobes_module_callback().
The mutex_lock() has originally been introduced to avoid conflict with text modification,
at that point we didn't hold text_mutex.
But after:
f1c6ece23729 ("kprobes: Fix potential deadlock in kprobe_optimizer()")
We started holding the text_mutex and don't need the modules mutex anyway.
So remove the module_mutex locking.
[ mingo: Amended the changelog. ]
Suggested-by: Ingo Molnar <mingo@...nel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Link: https://lore.kernel.org/r/20200728163400.e00b09c594763349f99ce6cb@kernel.org
---
kernel/kprobes.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 146c648..e87679a 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -598,8 +598,6 @@ static void kprobe_optimizer(struct work_struct *work)
mutex_lock(&kprobe_mutex);
cpus_read_lock();
mutex_lock(&text_mutex);
- /* Lock modules while optimizing kprobes */
- mutex_lock(&module_mutex);
/*
* Step 1: Unoptimize kprobes and collect cleaned (unused and disarmed)
@@ -624,7 +622,6 @@ static void kprobe_optimizer(struct work_struct *work)
/* Step 4: Free cleaned kprobes after quiesence period */
do_free_cleaned_kprobes();
- mutex_unlock(&module_mutex);
mutex_unlock(&text_mutex);
cpus_read_unlock();
Powered by blists - more mailing lists