Re: [patch] PI-futex: -V2

From: Ingo Molnar
Date: Sun Mar 26 2006 - 18:30:03 EST



* Andrew Morton <akpm@xxxxxxxx> wrote:

> 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))

ah, indeed, you are right.

> Which might actually be less efficient, and more obscure. Just
> pointing it out.

ok, i left it as-is for now.

Ingo
-
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/