Skip to content

Commit 41534d4

Browse files
qiyeliutehcaster
authored andcommitted
mm/slub: Refactor note_cmpxchg_failure for better readability
Use IS_ENABLED() and standard if-else to make the code clearer. Signed-off-by: Ye Liu <[email protected]> Reviewed-by: Harry Yoo <[email protected]> Reviewed-by: Christoph Lameter (Ampere) <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent ba7a896 commit 41534d4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mm/slub.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,18 +3069,17 @@ static inline void note_cmpxchg_failure(const char *n,
30693069

30703070
pr_info("%s %s: cmpxchg redo ", n, s->name);
30713071

3072-
#ifdef CONFIG_PREEMPTION
3073-
if (tid_to_cpu(tid) != tid_to_cpu(actual_tid))
3072+
if (IS_ENABLED(CONFIG_PREEMPTION) &&
3073+
tid_to_cpu(tid) != tid_to_cpu(actual_tid)) {
30743074
pr_warn("due to cpu change %d -> %d\n",
30753075
tid_to_cpu(tid), tid_to_cpu(actual_tid));
3076-
else
3077-
#endif
3078-
if (tid_to_event(tid) != tid_to_event(actual_tid))
3076+
} else if (tid_to_event(tid) != tid_to_event(actual_tid)) {
30793077
pr_warn("due to cpu running other code. Event %ld->%ld\n",
30803078
tid_to_event(tid), tid_to_event(actual_tid));
3081-
else
3079+
} else {
30823080
pr_warn("for unknown reason: actual=%lx was=%lx target=%lx\n",
30833081
actual_tid, tid, next_tid(tid));
3082+
}
30843083
#endif
30853084
stat(s, CMPXCHG_DOUBLE_CPU_FAIL);
30863085
}

0 commit comments

Comments
 (0)