Skip to content

anv/block_pool: Align anv_block_pool state to 64 bits.

On 64 bits platforms, some atomic operations like __sync_fetch_and_add() have constant time, but on 32 bits platforms they are implemented with a loop and might take much longer.

Additionally, it seems like if their operands are not aligned to 64 bits, they also require extra memory accesses. From the Intel Architecture's Developer Manual Vol. 1, 4.1.1:

"A word or doubleword operand that crosses a 4-byte boundary or a quadword operand that crosses an 8-byte boundary is considered unaligned and requires two separate memory bus cycles for access."

Forcing the u64 field to be aligned to 64 bits seems to make the unit tests that are stressing this finish much faster.

I'm not sure the explanation or comments are good enough, but it seems to to fix issue #1200 (closed)

/cc @daenzer @llandwerlin @anholt

Merge request reports