[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220615091501.0323c2c7cc89b2d337cb0322@kernel.org>
Date: Wed, 15 Jun 2022 09:15:01 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: l3b2w1@...il.com
Cc: naveen.n.rao@...ux.ibm.com, anil.s.keshavamurthy@...el.com,
davem@...emloft.net, linux-kernel@...r.kernel.org,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH] kprobes: drop the unnecessary unlikely()
On Mon, 13 Jun 2022 12:25:36 +0800
l3b2w1@...il.com wrote:
> From: "binglei.wang" <l3b2w1@...il.com>
>
> !ap is likely when checking re-registering existing kprobe.
> register_kprobe -> warn_kprobe_rereg -> __get_valid_kprobe
>
> !ap is unlikely when checking whether the kprobe is valid
> on enable/disable ocassion.
> __disable_kprobe/enable_kprobe -> __get_valid_kprobe
>
> Considering these two cases, choose to drop the unlikely() here.
>
> Signed-off-by: binglei.wang <l3b2w1@...il.com>
This looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
Thank you!
> ---
> kernel/kprobes.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index f214f8c08..f4a829d98 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -1504,7 +1504,7 @@ static struct kprobe *__get_valid_kprobe(struct kprobe *p)
> lockdep_assert_held(&kprobe_mutex);
>
> ap = get_kprobe(p->addr);
> - if (unlikely(!ap))
> + if (!ap)
> return NULL;
>
> if (p != ap) {
> --
> 2.27.0
>
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists