Re: PROBLEM --> Atomic operations in mmap attached address space...

Alan Cox (alan@lxorguk.ukuu.org.uk)
Fri, 20 Dec 1996 00:07:14 +0000 (GMT)


> I am having some trouble with atomic operations in "mmap" mapped
> address space... These work fine when the same memory is mapped with "shmat"
> !!!

Thats potentially just luck. Especially if you are using a sparc ;)

> asm volatile ("
> lock ;
> btsl %2,%1\n\tsbbl %0,%0"
> :"=r" (oldbit),"=m" (ADDR)
> :"ir" (nr));

Not atomic if it takes a page fault I suspect

Normally you should use the semop() syscalls. If you want to play
dangerously (and non portably) you can do stuff directly. On the intel
it will probably work as the Intel processors are fully cache coherent
and Linux has nothing to do with them. Even then I'd really recommend you
never do certain things like share FPU values and the FPU's are sometimes
a bit asynchronous to the CPU.

Alan