Re: spinaphore conceptual draft

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 30, 2005, at 15:28:26, Andi Kleen wrote:
On Mon, May 30, 2005 at 02:04:36PM -0400, Kyle Moffett wrote:
I suspect any attempt to use time stamps in locks is a bad
idea because of this.

Something like this could be built only for CPUs that do support that
kind of cycle counter.

That gets you into a problem with binary distribution kernels.
While binary patching works to some extent, it also becomes
messy pretty quickly.

Well, a runtime-set function-pointer isn't all that bad.  Basically
if a simple cycle-counter driver is available, it would use that,
otherwise it would fall back to ordinary spinlock behavior.

The idea behind these locks is for bigger systems (8-way or more) for
heavily contended locks (say 32 threads doing write() on the same fd).

Didn't Dipankar & co just fix that with their latest RCU patchkit?
(assuming you mean the FD locks)

That's lock-free FD lookup (open, close, and read/write to a certain
extent).  I'm handling something more like serialization on a fifo
accessed in both user context and interrupt context, which in a
traditional implementation would use a spinlock, but with a spinaphore,
one could do this:

In interrupt context:

spinaphore_lock_atomic(&fifo->sph);
put_stuff_in_fifo(fifo,stuff);
spinaphore_unlock(&fifo->sph);

In user context:

spinaphore_lock(&fifo->sph);
put_stuff_in_fifo(fifo,stuff);
spinaphore_unlock(&fifo->sph);

If there are multiple devices generating interrupts to put stuff in the
fifo and multiple processes also trying to put stuff in the fifo, all
bursting on different CPUs, then the fifo lock would be heavily loaded.
If the system had other things it could be doing while waiting for the
FIFO to become available, then it should be able to do those.

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r !y?(-)
------END GEEK CODE BLOCK------



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux