[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpXS5Dm-pCAu+7t+9RRauW=q64i6VCQ-Gz6j9_qFMPcOjA@mail.gmail.com>
Date: Wed, 16 Oct 2019 10:28:04 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
Linux Kernel Network Developers <netdev@...r.kernel.org>,
Jamal Hadi Salim <jhs@...atatu.com>,
Jiri Pirko <jiri@...nulli.us>,
Eric Dumazet <edumazet@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Marc Kleine-Budde <mkl@...gutronix.de>,
Peter Zijlstra <peterz@...radead.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next v2] net: sched: Avoid using yield() in a busy
waiting loop
On Wed, Oct 16, 2019 at 1:28 AM Sebastian Andrzej Siewior
<bigeasy@...utronix.de> wrote:
>
> From: Marc Kleine-Budde <mkl@...gutronix.de>
>
> 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
BTW, this link doesn't work, 404 is returned.
> Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
> [bigeasy: Rewrite commit message, add comment, use
> schedule_timeout_uninterruptible()]
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
> v1…v2: Typo fixes, noticed by Sergei Shtylyov.
>
> net/sched/sch_generic.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
> index 17bd8f539bc7f..974731b86c20c 100644
> --- a/net/sched/sch_generic.c
> +++ b/net/sched/sch_generic.c
> @@ -1217,8 +1217,13 @@ void dev_deactivate_many(struct list_head *head)
>
> /* Wait for outstanding qdisc_run calls. */
> list_for_each_entry(dev, head, close_list) {
> - while (some_qdisc_is_busy(dev))
> - yield();
> + while (some_qdisc_is_busy(dev)) {
> + /* wait_event() would avoid this sleep-loop but would
> + * require expensive checks in the fast paths of packet
> + * processing which isn't worth it.
> + */
> + schedule_timeout_uninterruptible(1);
I am curious why this is uninterruptible?
Thanks.
Powered by blists - more mailing lists