[ofa-general] Re: [PATCH] mlx4: confiugre cache line size

Roland Dreier rdreier at cisco.com
Tue Sep 22 10:51:10 PDT 2009


 > +#if defined(cache_line_size)

Why the #if here?  Do we just need to include <linux/cache.h> explicitly
to make sure we get the define?

 > +	*((u8 *) mailbox->buf + INIT_HCA_CACHELINE_SZ_OFFSET) =
 > +		order_base_2(cache_line_size() / 16) << 5;

Trivial but I think it's safe to assume a cacheline is always a power of
2.  And I think it's clearer (and avoids generating a divide) to use
subtraction rather than division... so this could all become:

		(ilog2(cache_line_size()) - 4) << 5;

 - R.



More information about the general mailing list