Re: [PATCH] Futex Asynchronous Interface

Rusty Russell (rusty@rustcorp.com.au)
Fri, 07 Jun 2002 08:59:19 +1000


In message <3CFF8904.9010703@dlr.de> you write:
> Hi Rusty,
>
> >if (this->page == page && this->offset == offset) {
> > list_del_init(i);
> > tell_waiter(this);
> >+ unpin_page(this->page);
> > num_woken++;
> > if (num_woken >= num) break;
> > }
> > }
> > spin_unlock(&futex_lock);
> >+ unpin_page(page);
> > return num_woken;
>
> If I understand right you shouldn't unpin the page if you are not sure that
> all waiters for a specific (page,offset)-combination are woken up and deleted
> from the waitqueue. Otherwise a second call to futex_wake may look on the wro
ng
> hash_queue or wake the wrong waiters.

No, we delete them from the list (list_del_init) so we can't find it
again: ie. futex_wake can't be invoked twice on the same thing without
someone putting it back on the queue...

> In general, I think fast userspace synchronization primitives and
> asynchronous notification are different enough to keep them
> logically more separated. Your double use of the hashed wait queues
> and sys_call make the code difficult to grasp and thus open for
> subtle error.

I don't think the complexity is much worse: async is inherently
complex given that there are no real in-kernel primitives to do offer
both sync and async cleanly. Having two incompatible primitives would
be painful, too.

Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
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/