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


Groups > linux.kernel > #1194661 > unrolled thread

Re: Next round: revised futex(2) man page for review

Started byPeter Zijlstra <peterz@infradead.org>
First post2015-07-28 22:50 +0200
Last post2015-07-29 04:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Next round: revised futex(2) man page for review Peter Zijlstra <peterz@infradead.org> - 2015-07-28 22:50 +0200
    Re: Next round: revised futex(2) man page for review Thomas Gleixner <tglx@linutronix.de> - 2015-07-28 23:10 +0200
    Re: Next round: revised futex(2) man page for review Davidlohr Bueso <dave@stgolabs.net> - 2015-07-29 04:10 +0200

#1194661 — Re: Next round: revised futex(2) man page for review

FromPeter Zijlstra <peterz@infradead.org>
Date2015-07-28 22:50 +0200
SubjectRe: Next round: revised futex(2) man page for review
Message-ID<pRjYZ-3vU-3@gated-at.bofh.it>
On Tue, Jul 28, 2015 at 10:23:51PM +0200, Thomas Gleixner wrote:

> >        FUTEX_WAKE (since Linux 2.6.0)
> >               This  operation  wakes at most val of the waiters that are
> >               waiting (e.g., inside FUTEX_WAIT) on the futex word at the
> >               address  uaddr.  Most commonly, val is specified as either
> >               1 (wake up a single waiter) or INT_MAX (wake up all  wait‐
> >               ers).   No  guarantee  is provided about which waiters are
> >               awoken (e.g., a waiter with a higher  scheduling  priority
> >               is  not  guaranteed to be awoken in preference to a waiter
> >               with a lower priority).
> 
> That's only correct up to Linux 2.6.21.
> 
> Since 2.6.22 we have a priority ordered wakeup. For SCHED_OTHER
> threads this takes the nice level into account. Threads with the same
> priority are woken in FIFO order.

Maybe don't mention the effects of SCHED_OTHER, order by nice value is
'wrong'.

Also, this code seems to use plist, which means it won't do the right
thing for SCHED_DEADLINE either.

Do we want to go fix that?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1194667

FromThomas Gleixner <tglx@linutronix.de>
Date2015-07-28 23:10 +0200
Message-ID<pRkil-47H-5@gated-at.bofh.it>
In reply to#1194661

[Multipart message — attachments visible in raw view] — view raw

On Tue, 28 Jul 2015, Peter Zijlstra wrote:

> On Tue, Jul 28, 2015 at 10:23:51PM +0200, Thomas Gleixner wrote:
> 
> > >        FUTEX_WAKE (since Linux 2.6.0)
> > >               This  operation  wakes at most val of the waiters that are
> > >               waiting (e.g., inside FUTEX_WAIT) on the futex word at the
> > >               address  uaddr.  Most commonly, val is specified as either
> > >               1 (wake up a single waiter) or INT_MAX (wake up all  wait‐
> > >               ers).   No  guarantee  is provided about which waiters are
> > >               awoken (e.g., a waiter with a higher  scheduling  priority
> > >               is  not  guaranteed to be awoken in preference to a waiter
> > >               with a lower priority).
> > 
> > That's only correct up to Linux 2.6.21.
> > 
> > Since 2.6.22 we have a priority ordered wakeup. For SCHED_OTHER
> > threads this takes the nice level into account. Threads with the same
> > priority are woken in FIFO order.
> 
> Maybe don't mention the effects of SCHED_OTHER, order by nice value is
> 'wrong'.

Indeed.
 
> Also, this code seems to use plist, which means it won't do the right
> thing for SCHED_DEADLINE either.
> 
> Do we want to go fix that?

I think so.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1194773

FromDavidlohr Bueso <dave@stgolabs.net>
Date2015-07-29 04:10 +0200
Message-ID<pRoYF-2B2-11@gated-at.bofh.it>
In reply to#1194661
On Tue, 2015-07-28 at 22:45 +0200, Peter Zijlstra wrote:
> Also, this code seems to use plist, which means it won't do the right
> thing for SCHED_DEADLINE either.

Ick, I don't look forward to seeing nice futex plists converted into
rbtrees. As opposed to, eg. rtmutexes, there are a few caveats:

- Dealing with the top_waiter in rtmutexes is always easy, but in
futexes we need to deal with keys, so caching the leftmost won't work as
nicely.

- This will bloat things like futex_wake, where O(logN) is not suited
for FIFO iteration. And iterating linked lists is, in essence, all that
we really do when calling futex(2).

I have to wonder about the extra overhead added by these points.  I do
understand the dl concern, nonetheless.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web