From: Mike Galbraith <efault@gmx.de>
To: netdev <netdev@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: net/sched: latent livelock in dev_deactivate_many() due to yield() usage
Date: Sun, 02 Apr 2017 06:28:41 +0200 [thread overview]
Message-ID: <1491107321.13631.33.camel@gmx.de> (raw)
Greetings network wizards,
Quoting kernel/sched/core.c:
/**
* yield - yield the current processor to other threads.
*
* Do not ever use this function, there's a 99% chance you're doing it wrong.
*
* The scheduler is at all times free to pick the calling task as the most
* eligible task to run, if removing the yield() call from your code breaks
* it, its already broken.
*
* Typical broken usage is:
*
* while (!event)
* yield();
*
* where one assumes that yield() will let 'the other' process run that will
* make event true. If the current task is a SCHED_FIFO task that will never
* happen. Never use yield() as a progress guarantee!!
*
* If you want to use yield() to wait for something, use wait_event().
* If you want to use yield() to be 'nice' for others, use cond_resched().
* If you still want to use yield(), do not!
*/
Livelock can be triggered by setting kworkers to SCHED_FIFO, then
suspend/resume.. you come back from sleepy-land with a spinning
kworker. For whatever reason, I can only do that with an enterprise
like config, my standard config refuses to play, but no matter, it's
"Typical broken usage".
(yield() should be rendered dead)
-Mike
next reply other threads:[~2017-04-02 4:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-02 4:28 Mike Galbraith [this message]
2017-04-04 22:39 ` net/sched: latent livelock in dev_deactivate_many() due to yield() usage Cong Wang
2017-04-05 3:20 ` Mike Galbraith
2017-04-05 5:25 ` Cong Wang
2017-04-05 6:12 ` Mike Galbraith
2017-04-05 23:55 ` Cong Wang
2017-04-06 1:08 ` Mike Galbraith
2017-04-06 10:26 ` Peter Zijlstra
2017-04-06 0:31 ` Stephen Hemminger
2017-04-06 1:28 ` Mike Galbraith
2017-04-06 10:28 ` Peter Zijlstra
2017-04-06 11:08 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491107321.13631.33.camel@gmx.de \
--to=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).