Re: bitops atomicity question

Matti Aarnio (matti.aarnio@tele.fi)
Mon, 25 Aug 1997 12:58:08 +0300 (EET DST)


> Date: Sun, 24 Aug 1997 23:55:21 +0200
> From: Pavel Machek <pavel@Elf.mj.gts.cz>
>
> I just would like to ask:
>
> Is test_and_clear_bit guaranteed to be atomic on SMP machines? (I
> would like to create my own locking from userland - ipc semaphores
> are way too slow - and need some atomic operations...)
>
> Depends upon the platform:
...
> m68k: N/A yet 8-)

With TAS instruction you get this, also with CAS.
The bus-lock is implicite. (They are 'Test And Set',
and 'Compare And Set' instructions respectively.)
However those operate on 1/2/4 byte entities only,
not on BITS.

> Later,
> David "Sparc" Miller
> davem@caip.rutgers.edu

/Matti Aarnio <matti.aarnio@tele.fi>