[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f8127c0c-9de5-4430-ade4-45df78862d28@suse.cz>
Date: Wed, 10 Sep 2025 08:46:21 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Ye Liu <ye.liu@...ux.dev>, Andrew Morton <akpm@...ux-foundation.org>
Cc: Ye Liu <liuye@...inos.cn>, Harry Yoo <harry.yoo@...cle.com>,
Christoph Lameter <cl@...two.org>, David Rientjes <rientjes@...gle.com>,
Roman Gushchin <roman.gushchin@...ux.dev>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] mm/slub: Refactor note_cmpxchg_failure for better
readability
On 9/9/25 03:33, Ye Liu wrote:
> From: Ye Liu <liuye@...inos.cn>
>
> Use IS_ENABLED() and standard if-else to make the code clearer.
>
> Signed-off-by: Ye Liu <liuye@...inos.cn>
> Reviewed-by: Harry Yoo <harry.yoo@...cle.com>
> Reviewed-by: Christoph Lameter (Ampere) <cl@...two.org>
Thanks, added to slab/for-next
>
> ---
> Changes in v3:
> - Add "---" in front of the change log.
> Changes in v2:
> - Insert newline after && as it's more than 80 columns.
> ---
> mm/slub.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 30003763d224..5711d6d29a3f 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3064,18 +3064,17 @@ static inline void note_cmpxchg_failure(const char *n,
>
> pr_info("%s %s: cmpxchg redo ", n, s->name);
>
> -#ifdef CONFIG_PREEMPTION
> - if (tid_to_cpu(tid) != tid_to_cpu(actual_tid))
> + if (IS_ENABLED(CONFIG_PREEMPTION) &&
> + tid_to_cpu(tid) != tid_to_cpu(actual_tid)) {
> pr_warn("due to cpu change %d -> %d\n",
> tid_to_cpu(tid), tid_to_cpu(actual_tid));
> - else
> -#endif
> - if (tid_to_event(tid) != tid_to_event(actual_tid))
> + } else if (tid_to_event(tid) != tid_to_event(actual_tid)) {
> pr_warn("due to cpu running other code. Event %ld->%ld\n",
> tid_to_event(tid), tid_to_event(actual_tid));
> - else
> + } else {
> pr_warn("for unknown reason: actual=%lx was=%lx target=%lx\n",
> actual_tid, tid, next_tid(tid));
> + }
> #endif
> stat(s, CMPXCHG_DOUBLE_CPU_FAIL);
> }
Powered by blists - more mailing lists