Re: [patch] 2.4.4 alpha semaphores optimization

Ivan Kokshaysky
2001-05-05T13:57:33Z

On Fri, May 04, 2001 at 02:12:40PM -0700, Richard Henderson wrote:
> > - removed some mb's for non-SMP
>
> This isn't correct. Either you need atomic updates or you don't.
> If you don't, then you shouldn't be using ll/sc at all.

I don't think so. On a single CPU system we need atomic updates
to protect modifying of critical variables from interrupts, and
ll/sc sequences guarantee exactly that. But on UP system we don't
need memory barriers of any kind (I mean system memory space accesses,
not IO, of course), as we don't care about read/write ordering at all.

> If you do
> (perhaps to coordinate with devices) then the barriers are required.

For IO space access mb's are required, but ll/sc are of no use, AFAIK.

However, if I understand correctly, the r/w semaphores can't be used from
interrupt context, so in this case I'd agree -- this stuff could be made
completely non-atomic for UP.

> > - removed non-inline up()/down_xx() when semaphore/waitqueue debugging
> > isn't enabled.
>
> They should still be exported for module compatibility.

If you mean some external modules, then ok. The modules built from the
main tree shouldn't have any problems...

Ivan.