[PATCH 6/8] perf sched: Use RC_CHK_EQUAL() to compare pointers

Namhyung Kim posted 8 patches 3 months, 1 week ago
[PATCH 6/8] perf sched: Use RC_CHK_EQUAL() to compare pointers
Posted by Namhyung Kim 3 months, 1 week ago
So that it can check two pointers to the same object properly when
REFCNT_CHECKING is on.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index a6eb0462dd5be20f..087d4eaba5f7160d 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -994,7 +994,7 @@ thread_atoms_search(struct rb_root_cached *root, struct thread *thread,
 		else if (cmp < 0)
 			node = node->rb_right;
 		else {
-			BUG_ON(thread != atoms->thread);
+			BUG_ON(!RC_CHK_EQUAL(thread, atoms->thread));
 			return atoms;
 		}
 	}
-- 
2.50.0.727.gbf7dc18ff4-goog
Re: [PATCH 6/8] perf sched: Use RC_CHK_EQUAL() to compare pointers
Posted by Ian Rogers 3 months ago
On Wed, Jul 2, 2025 at 6:49 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> So that it can check two pointers to the same object properly when
> REFCNT_CHECKING is on.
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/builtin-sched.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index a6eb0462dd5be20f..087d4eaba5f7160d 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -994,7 +994,7 @@ thread_atoms_search(struct rb_root_cached *root, struct thread *thread,
>                 else if (cmp < 0)
>                         node = node->rb_right;
>                 else {
> -                       BUG_ON(thread != atoms->thread);
> +                       BUG_ON(!RC_CHK_EQUAL(thread, atoms->thread));
>                         return atoms;
>                 }
>         }
> --
> 2.50.0.727.gbf7dc18ff4-goog
>