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: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230228161426.4508-1-ubizjak@gmail.com
This commit is contained in:
Uros Bizjak 2023-02-28 17:14:26 +01:00 committed by Ingo Molnar
parent c0490bc9bb
commit 4ff34ad3d3

View File

@ -919,14 +919,13 @@ static bool set_nr_if_polling(struct task_struct *p)
struct thread_info *ti = task_thread_info(p); struct thread_info *ti = task_thread_info(p);
typeof(ti->flags) val = READ_ONCE(ti->flags); typeof(ti->flags) val = READ_ONCE(ti->flags);
for (;;) { do {
if (!(val & _TIF_POLLING_NRFLAG)) if (!(val & _TIF_POLLING_NRFLAG))
return false; return false;
if (val & _TIF_NEED_RESCHED) if (val & _TIF_NEED_RESCHED)
return true; return true;
if (try_cmpxchg(&ti->flags, &val, val | _TIF_NEED_RESCHED)) } while (!try_cmpxchg(&ti->flags, &val, val | _TIF_NEED_RESCHED));
break;
}
return true; return true;
} }