Some minor comment/format changes.

This commit is contained in:
Andrea Mazzoleni 2014-01-04 17:29:25 +01:00
parent 21436089c7
commit d7ba004e30
2 changed files with 14 additions and 7 deletions

View file

@ -23,13 +23,17 @@
#define RAID_MALLOC_ALIGN 256
/**
* Memory displacement to avoid cache collisions on contiguous blocks,
* Memory displacement to avoid cache address sharing on contiguous blocks,
* used by raid_malloc_vector().
*
* When allocating a sequence of blocks with a size of power of 2,
* there is the risk that the start of each block is mapped into the same
* cache line or prefetching prediction, resulting in collisions if you
* access all the blocks in parallel, from the start to the end.
* there is the risk that the addresses of each block are mapped into the
* same cache line and prefetching predictor, resulting in a lot of cache
* sharing if you access all the blocks in parallel, from the start to the
* end.
*
* To avoid this effect, it's better if all the blocks are allocated
* with a fixed displacement trying to reduce the cache addresses sharing.
*
* The selected value was choosen empirically with some speed tests
* with 8/12/16/20/24 data buffers of 256 KB.

View file

@ -20,9 +20,12 @@ static const struct gfzconst16 {
uint8_t half[16];
uint8_t low7[16];
} gfzconst16 __aligned(64) = {
{ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d },
{ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e },
{ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f }
{ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d },
{ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e },
{ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f }
};
#endif