Re: [PATCH] Futex Asynchronous Interface

From: Martin Wirth (martin.wirth@dlr.de)
Date: Thu Jun 06 2002 - 11:08:36 EST


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 wrong
hash_queue or wake the wrong waiters.

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.

Martin

Martin

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



This archive was generated by hypermail 2b29 : Fri Jun 07 2002 - 22:00:28 EST