From: Mike Galbraith <efault@gmx.de>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: net/sched: latent livelock in dev_deactivate_many() due to yield() usage
Date: Thu, 06 Apr 2017 03:08:47 +0200 [thread overview]
Message-ID: <1491440927.4718.21.camel@gmx.de> (raw)
In-Reply-To: <CAM_iQpVz5_9C_4=rmWjr6khTAz2jHc_RPGrWb+FXVTA7RSC=5A@mail.gmail.com>
On Wed, 2017-04-05 at 16:55 -0700, Cong Wang wrote:
> On Tue, Apr 4, 2017 at 11:12 PM, Mike Galbraith <efault@gmx.de> wrote:
> > On Tue, 2017-04-04 at 22:25 -0700, Cong Wang wrote:
> > > On Tue, Apr 4, 2017 at 8:20 PM, Mike Galbraith <efault@gmx.de> wrote:
> > > > - while (some_qdisc_is_busy(dev))
> > > > - yield();
> > > > + swait_event_timeout(swait,
> > > > !some_qdisc_is_busy(dev), 1);
> > > > }
> > >
> > > I don't see why this is an improvement even if I don't care about the
> > > hardcoded timeout for now... Why the scheduler can make a better
> > > decision with swait_event_timeout() than with cond_resched()?
> >
> > Because sleeping gets you out of the way? There is no other decision
> > the scheduler can make while a SCHED_FIFO task is trying to yield when
> > it is the one and only task at it's priority. The scheduler is doing
> > exactly what it is supposed to do, problem is people calling yield()
> > tend to think it does something it does not do, which is why it is
> > decorated with "if you think you want yield(), think again"
> >
> > Yes, yield semantics suck rocks, basically don't exist. Hop in your
> > time machine and slap whoever you find claiming responsibility :)
>
> I am not trying to defend for yield(), I am trying to understand when
> cond_resched() is not a right solution to replace yield() and when it is.
> For me, the dev_deactivate_many() case is, because I interpret
> "be nice" differently.
Yeah, I know you weren't defending it, just as I know that the net-fu
masters don't need that comment held close to their noses in order to
be able to read it.. waving it about wasn't for their benefit ;-)
-Mike
next prev parent reply other threads:[~2017-04-06 1:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-02 4:28 net/sched: latent livelock in dev_deactivate_many() due to yield() usage Mike Galbraith
2017-04-04 22:39 ` 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 [this message]
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=1491440927.4718.21.camel@gmx.de \
--to=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=xiyou.wangcong@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.