Re: [PATCH -tip 1/5] [CLEANUP] kprobes: Remove redundanttext_mutex lock in optimize
From: Mathieu Desnoyers
Date: Tue May 11 2010 - 08:35:58 EST
* Masami Hiramatsu (mhiramat@xxxxxxxxxx) wrote:
> Remove text_mutex locking in optimize_all_kprobes, because
> that function doesn't modify text but just order optimization
> to worker.
Hi Masami,
A few comments:
1) optimize_all_kprobes/unoptimize_all_kprobes should have comments saying that
they are always called with kprobe_mutex held.
2) The sentence above in the changelog could be changed into:
..."because this function doesn't modify text. It simply queues optimizations
for the kprobe_optimizer worker thread."
3)
static DEFINE_MUTEX(kprobe_mutex); /* Protects kprobe_table */
.. should also state that it protects optimizing_list.
Thanks,
Mathieu
>
> Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
> Cc: Ananth N Mavinakayanahalli <ananth@xxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> Cc: Jim Keniston <jkenisto@xxxxxxxxxx>
> Cc: Jason Baron <jbaron@xxxxxxxxxx>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
> ---
>
> kernel/kprobes.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 282035f..1d34eef 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -606,14 +606,12 @@ static void __kprobes optimize_all_kprobes(void)
> return;
>
> kprobes_allow_optimization = true;
> - mutex_lock(&text_mutex);
> for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
> head = &kprobe_table[i];
> hlist_for_each_entry_rcu(p, node, head, hlist)
> if (!kprobe_disabled(p))
> optimize_kprobe(p);
> }
> - mutex_unlock(&text_mutex);
> printk(KERN_INFO "Kprobes globally optimized\n");
> }
>
>
>
> --
> Masami Hiramatsu
> e-mail: mhiramat@xxxxxxxxxx
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/