public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] WorkStruct: Implement generic UP cmpxchg() where an
@ 2006-12-11  2:30 linux
  2006-12-11  4:30 ` Nick Piggin
  2006-12-11  4:49 ` Linus Torvalds
  0 siblings, 2 replies; 7+ messages in thread
From: linux @ 2006-12-11  2:30 UTC (permalink / raw)
  To: nickpiggin, torvalds; +Cc: linux, linux-arch, linux-arm-kernel, linux-kernel

> Even if ARM is able to handle any arbitrary C code between the
> "load locked" and store conditional API, other architectures can not
> by definition.

Maybe so, but I think you and Linus are missing the middle ground.

While I agree that LL/SC can't be part of the kernel API for people to
get arbitrarily clever with in the device driver du jour, they are *very*
nice abstractions for shrinking the arch-specific code size.

The semantics are widely enough shared that it's quite possible in
practice to write a good set of atomic primitives in terms of LL/SC
and then let most architectures define LL/SC and simply #include the
generic atomic op implementations.

If there's a restriction that would pessimize the generic implementation,
that function can be implemented specially for that arch.

Then implementing things like backoff on contention can involve writing
a whole lot less duplicated code.


Just like you can write a set of helpers for, say, CPUs with physically
addressed caches, even though the "real" API has to be able to handle the
virtually addressed ones, you can write a nice set of helpers for machines
with sane LL/SC.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-12-12 10:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-11  2:30 [PATCH] WorkStruct: Implement generic UP cmpxchg() where an linux
2006-12-11  4:30 ` Nick Piggin
2006-12-11  6:17   ` linux
2006-12-11  7:36     ` Nick Piggin
2006-12-12  3:24       ` linux
2006-12-12 10:37         ` David Howells
2006-12-11  4:49 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox