Commit 41534d49 authored by Ye Liu's avatar Ye Liu Committed by Vlastimil Babka
Browse files

mm/slub: Refactor note_cmpxchg_failure for better readability



Use IS_ENABLED() and standard if-else to make the code clearer.

Signed-off-by: default avatarYe Liu <liuye@kylinos.cn>
Reviewed-by: default avatarHarry Yoo <harry.yoo@oracle.com>
Reviewed-by: default avatarChristoph Lameter (Ampere) <cl@gentwo.org>
Reviewed-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
parent ba7a8964
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -3069,18 +3069,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);
}