net: Remove conditional threaded-NAPI wakeup based on task state.
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 25 Mar 2024 07:40:28 +0000 (08:40 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 26 Mar 2024 11:17:18 +0000 (12:17 +0100)
commit56364c910691f6d10ba88c964c9041b9ab777bd6
tree67ca8ea8ec8c0791dd64b788b9af8ccb8586dd29
parent26f44b700536d0cf4d7ee33bed1692fc8af98fd2
net: Remove conditional threaded-NAPI wakeup based on task state.

A NAPI thread is scheduled by first setting NAPI_STATE_SCHED bit. If
successful (the bit was not yet set) then the NAPI_STATE_SCHED_THREADED
is set but only if thread's state is not TASK_INTERRUPTIBLE (is
TASK_RUNNING) followed by task wakeup.

If the task is idle (TASK_INTERRUPTIBLE) then the
NAPI_STATE_SCHED_THREADED bit is not set. The thread is no relying on
the bit but always leaving the wait-loop after returning from schedule()
because there must have been a wakeup.

The smpboot-threads implementation for per-CPU threads requires an
explicit condition and does not support "if we get out of schedule()
then there must be something to do".

Removing this optimisation simplifies the following integration.

Set NAPI_STATE_SCHED_THREADED unconditionally on wakeup and rely on it
in the wait path by removing the `woken' condition.

Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/core/dev.c