Re: down_spin() implementation

From: Nick Piggin
Date: Fri Mar 28 2008 - 21:33:55 EST


On Friday 28 March 2008 23:45, Matthew Wilcox wrote:

> I think we can do better here with:
>
> atomic_set(max);
>
> and
>
> while (unlikely(!atomic_add_unless(&ss->cur, -1, 0)))
> while (atomic_read(&ss->cur) == 0)
> cpu_relax();

Yeah of course! That's much better ;)

I'd say Tony could just open code it for now, which would get him
up and running quickly... although if anybody gets keen to add it
as a generic API then I wouldn't object.

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