tech-kern archive

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

Re: Dynamically allocated locks



On Thu, Mar 27, 2008 at 10:48:19AM -0700, Tim Rightnour wrote:

> >> This patch allows for dynamically allocated locks.
> >> 
> >> http://www.netbsd.org/~ad/lockobj.diff
> 
> My problem with this diff, isn't so much with the diff itself, but that it
> relies on CACHE_LINE_SIZE.  On powerpc, we have multiple cache line sizes that
> are possible, and using the compiled-in constant CACHE_LINE_SIZE isn't 
> feasable.
> 
> I realize however, that this isn't directly what you are trying to fix,
> however, up until now, the uses of CACHE_LINE_SIZE were primarily for 
> alignment
> reasons, and by picking a least common denominator for that define, we mostly
> got away with it on the ppc machines that have 128b/l caches.  Now that you
> want to use it to limit a lock to per-line, that will no longer be the case,
> and we will end up with multiple locks in a cache line on those cpu's.
> 
> I think we need a better solution for that define in general.

I agree, which is why I proposed a run-time tuneable (coherency_unit). There
are a minority of places where a tuneable will not do so I'll introduce a
macro for those. It could be overridden in machine/param.h. I'll also get
rid of the badly named CACHE_LINE_SIZE.

Andrew


Home | Main Index | Thread Index | Old Index