]> git.baikalelectronics.ru Git - kernel.git/commit
net: sched: Avoid using yield() in a busy waiting loop
authorMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 16 Oct 2019 08:28:33 +0000 (10:28 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Oct 2019 19:33:03 +0000 (15:33 -0400)
commit29e5977a4d5c2ae0df1fb380ba9d21bbf7d57a62
tree3ca671a812d9ad9f80af00e04ea9e899f7dc6a6c
parentf87c8bb3fbbe2dadb0aa708316a807ec536ad93f
net: sched: Avoid using yield() in a busy waiting loop

With threaded interrupts enabled, the interrupt thread runs as SCHED_RR
with priority 50. If a user application with a higher priority preempts
the interrupt thread and tries to shutdown the network interface then it
will loop forever. The kernel will spin in the loop waiting for the
device to become idle and the scheduler will never consider the
interrupt thread because its priority is lower.

Avoid the problem by sleeping for a jiffy giving other tasks,
including the interrupt thread, a chance to run and make progress.

In the original thread it has been suggested to use wait_event() and
properly waiting for the state to occur. DaveM explained that this would
require to add expensive checks in the fast paths of packet processing.

Link: https://lkml.kernel.org/r/1393976987-23555-1-git-send-email-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
[bigeasy: Rewrite commit message, add comment, use
          schedule_timeout_uninterruptible()]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_generic.c