Re: [PATCH 0/3] 64-bit futexes: Intro
- From: Ingo Molnar <mingo@xxxxxxx>
- Date: Tue, 3 Jun 2008 01:03:17 +0200
* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
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).
No, "unlocks as a natural barrier" only works for exclusive kernel
locks (spin_unlock and write_unlock). There we can just do a write to
unlock. But for anything that wants to handle contention differently
than just spinning, the unlock path needs to be able to do an atomic
"unlock and test if I need to do something else", because it may need
to wake things up.
yeah, indeed. Compared to all the other costs that have to be dealt with
here, having a second atomic op isnt all that much of an issue either,
especially on latest hw. An atomic op will probably never be as cheap as
a non-atomic op, but ~20 cycles is still plenty fast for most practical
purposes.
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: Nick Piggin
- 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
- From: Ingo Molnar
- Re: [PATCH 0/3] 64-bit futexes: Intro
- From: Linus Torvalds
- Re: [PATCH 0/3] 64-bit futexes: Intro
- Prev by Date: Re: CONFIG_PREEMPT causes corruption of application's FPU stack
- Next by Date: Re: Inquiry: Should we remove "isolcpus= kernel boot option? (may have realtime uses)
- 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
|