L1/L2 Cache Coloring from Userland ?

J.D. Bakker (bakker@thorgal.et.tudelft.nl)
Wed, 17 Sep 1997 22:24:28 +0200


Hi all,

Is there any way for a program to control or find out to which L1/L2 cache
lines/regions certain areas of memory are mapped ? Take the following
example:

void DoProcessing(unsigned char *src, unsigned char *dest, int count) {

char *t1 = malloc(256);
char *t2 = malloc(256);
char *t3 = malloc(256);
int i;

... Init tables t1, t2 and t3

for(i = 0; i < count; i+= 2) {

dest[i] = t1[src[i]] + t2[src[i+1]];
dest[i+1] = t2[src[i]] + t3[src[i + 1]];

}
}

Performance-wise, it would be most unfortunate if any of t1, t2, t3, src or
dest mapped to the same areas in cache. Can this be avoided ?

Sincerely,

Jan-Derk Bakker.

Life. In order of importance: food, shelter and a pair of very loud speakers.