Commit 4ff34ad3 authored by Uros Bizjak's avatar Uros Bizjak Committed by Ingo Molnar
Browse files

sched/core: Use do-while instead of for loop in set_nr_if_polling()



Use equivalent do-while loop instead of infinite for loop.

There are no asm code changes.

Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230228161426.4508-1-ubizjak@gmail.com
parent c0490bc9
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -919,14 +919,13 @@ static bool set_nr_if_polling(struct task_struct *p)
	struct thread_info *ti = task_thread_info(p);
	typeof(ti->flags) val = READ_ONCE(ti->flags);

	for (;;) {
	do {
		if (!(val & _TIF_POLLING_NRFLAG))
			return false;
		if (val & _TIF_NEED_RESCHED)
			return true;
		if (try_cmpxchg(&ti->flags, &val, val | _TIF_NEED_RESCHED))
			break;
	}
	} while (!try_cmpxchg(&ti->flags, &val, val | _TIF_NEED_RESCHED));

	return true;
}