Slowdown when accessing data at page boundaries? Hi I have a program which accesses memory words that are located X bytes apart in virtual address space. For instance, for (int i=0;&lt;some stop condition&gt;;i+=X){array[i]=4;}.

I measure the execution time with a varying value of X. Interestingly, when X is the power of 2 and is about page size, e.g., X=1024,2048,4096,8192..., I get to huge performance slowdown. But on all other values of X, like 1023 and 1025, there is no slowdown. The performance results are attached in the figure below.



I test my program on several personal machines, all are running Linux with x86_64 on Intel CPU. 

What could be the cause of this slowdown? We have tried row buffer in DRAM, L3 cache, etc. which do not seem make sense...
Go to Agner manuals page and download them all, you will find tons of interesting info there. In particular, microarchitecture.pdf says 


  There is a false dependence between memory addresses with the same set and offset, i.e. with a distance that is a multiple of 4 Kbytes:


;Example 9.6. Sandy bridge false memory dependence
mov [rsi],eax
mov ebx,[rsi+1000H] ;False memory dependence


I.e. the access becomes slower because cpu thinks that it may be the same address, so the load in the second line may depend on the store in the first line and thus cpu serializes execution of these operations.

AFAIR, it wasn't changed in latest Intel cpus.