Re: [PATCH 0/3] 64-bit futexes: Intro
- From: Ingo Molnar <mingo@xxxxxxx>
- Date: Mon, 2 Jun 2008 20:54:33 +0200
* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
IOW, I'm faking it, but I'm making a point. Namely that you can
efficiently do read-write lock using *only* 32-bit ops, and without
any real kind of limitations on the number of readers and writers.
So here goes the explanation and the pseudo-code.
- have two levels of locking: the contended case, and the uncontended
case
i suspect _any_ abstract locking functionality around a data structure
can be implemented via atomic control over just a single user-space bit.
That bit can be used as a lock and if all access to the state of that
atomic variable uses it, arbitrary higher-order atomic state transitions
can be derived from it. The cost would be a bit more instructions in the
fastpath, but there would still only be a single atomic op (the acquire
op), as the unlock would be a natural barrier (on x86 at least).
Concurrency (and scheduling) of that lock would still be exactly the
same as with genuine 64-bit (or even larger) atomic ops, and the
fastpath would be very close as well.
Ingo
--
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/
- Follow-Ups:
- Re: [PATCH 0/3] 64-bit futexes: Intro
- From: Linus Torvalds
- Re: [PATCH 0/3] 64-bit futexes: Intro
- References:
- Re: [PATCH 0/3] 64-bit futexes: Intro
- From: Linus Torvalds
- Re: [PATCH 0/3] 64-bit futexes: Intro
- Prev by Date: Re: [PATCH] ata: ahci: power off unused ports
- Next by Date: Re: linux-next: Tree for May 30
- Previous by thread: Re: [PATCH 0/3] 64-bit futexes: Intro
- Next by thread: Re: [PATCH 0/3] 64-bit futexes: Intro
- Index(es):
Relevant Pages
|