Re: [patch] PI-futex: -V2

From: Andrew Morton
Date: Sun Mar 26 2006 - 14:17:59 EST


Ingo Molnar <mingo@xxxxxxx> wrote:
>
> > > + for (;;) {
> > > + if (top_waiter)
> > > + plist_del(&top_waiter->pi_list_entry,
> > > + &owner->pi_waiters);
> > > +
> > > + if (waiter && waiter == rt_mutex_top_waiter(lock)) {
> >
> > rt_mutex_top_waiter() can never return NULL, so the test for NULL
> > could be removed.
>
> it might be NULL if adjust_pi_chain() is called from remove_waiter(),
> and next_waiter there is NULL (because !rt_mutex_has_waiters() after the
> removal of the current waiter).

Yes, `waiter' might be NULL. But rt_mutex_top_waiter() will never return
NULL. So it might be possible to just do

if (waiter == rt_mutex_top_waiter(lock))

Which might actually be less efficient, and more obscure. Just pointing it
out.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/