Fair enough. However, I wonder why you didn't just use the existing
(unaligned) types, and then on a lock-by-lock basis just mark them
aligned. That implies no code-changes.
Something like this should do it:
.. regular "spinlock_t" type
#define cachealign \
__attribute__((section("aligned"),__aligned__(SMP_CACHELINE_SIZE)))
(use a separate section so that subsequent data structures are also
guaranteed to be aligned - otherwise you might get false sharing from
non-aligned data structures that follow this one).
Eh?
Yes, we already try to do something like this, but due to the false
sharing with other stuff it doesn't _guarantee_ an exclusive cacheline.
Sometimes that is what you want (ie once you get the lock, it _can_ be
advantageous to have the hottest data structure associated with the lock
be in the same cacheline)
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/