lkml.org 
[lkml]   [2022]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] kprobes: drop the unnecessary unlikely()
Date
From: "binglei.wang" <l3b2w1@gmail.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@gmail.com>
---
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
\
 
 \ /
  Last update: 2022-06-13 06:26    [W:0.026 / U:0.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site