Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1681632

Re: [PATCH] firmware: wake all waiters

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH] firmware: wake all waiters
Date 2017-07-05 18:20 +0200
Message-ID <tZVbY-77-3@gated-at.bofh.it> (permalink)
References <tVGlc-9V-17@gated-at.bofh.it> <tWK3n-7Ki-5@gated-at.bofh.it> <tWLLQ-wL-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Tue, Jun 27, 2017 at 01:30:30AM +0200, Luis R. Rodriguez wrote:

> > But the *only* reason for swait is extreme memory issues and some very
> > special realtime issues, where it saves a couple of bytes in
> > structures that need close packing, and doesn't even use normal
> > spinlocks, so it saves a couple of cycles at wakeup/sleep because it
> > doesn't do a good job in general.

Yes, its about real-time. But it shouldn't be _that_ special purpose.

So swait should be capable of most things people want from a waitqueue.

Things it explicitly does not do are things like:

  - custom wake functions
  - exclusive mode
  - mixing different sleep types on a queue (which I would recommend
    against in any case).

But only very few people need those.

> > The "avoid normal spinlocks" is because it is meant for code that is
> > *so* special that it needs the magical low-level raw spinlocks.

> > I think the two valid users are RCU (which needed it for RT), and kvm
> > (which also needed it for similar issues - it needs to be
> > non-preemptible).

Right, so we need the raw_spinlock in order to run from non-preemptible
code on RT. And we then also need bounded runtimes on stuff.

The only function which is affected by that is swake_up_all(), that does
an unbounded list iteration and is therefore required to be called from
the schedulable context (so we can drop the lock and gain bounds on the
preemption latency).


But aside of all that, it should provide 'everything' people want from a
bog standard regular waitqueue. So I don't see why people shouldn't use
it more.

In any case, I'm not seeing why you call it idiotic.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] firmware: wake all waiters Peter Zijlstra <peterz@infradead.org> - 2017-07-05 18:20 +0200
  Re: [PATCH] firmware: wake all waiters Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-05 18:40 +0200
    Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-07-12 20:50 +0200

csiph-web