Re: [PATCH 07/12] rwsem: wake queued readers when writer blocks on active read lock

From: David Howells
Date: Wed May 12 2010 - 08:34:41 EST


Michel Lespinasse <walken@xxxxxxxxxx> wrote:

> + /* if there are no active locks, wake the front queued process(es) up.
> + *
> + * or if we're called from a failed down_write(), and there were
> + * already threads queued before us, and there are no active writers,
> + * the lock must be read owned; try to wake any read locks that were
> + * queued ahead of us. */

That looks weird. Can I suggest rewriting it thus:

/* If there are no active locks, wake the front queued process(es) up.
*
* Alternatively, if we're called from a failed down_write(), there
* were already threads queued before us and there are no active
* writers, the lock must be read owned; so we try to wake any read
* locks that were queued ahead of us. */

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