Re: [patch] Latency Tracer, voluntary-preempt-2.6.8-rc4-O6

From: Paulo Marques
Date: Sat Aug 14 2004 - 08:47:05 EST


Andi Kleen wrote:
The final algorithm pre-calculates markers on the compressed symbols so that the search time is almost divided by the number of markers.


You could do that at compile time (in scripts/kallsyms.c)

You're right! I'll see if I can come up with a patch.

If this is done in scripts/kallsyms.c, there is less code needed in the actual kernel, and there is no time penalty on the first lookup. This is a true win-win scenario :)

Thanks a lot for your suggestion.

There are still a few issues with this approach. The biggest issue is that this is clearly a speed/space trade-off, and maybe we don't want to waste the space on a code path that is not supposed to be "hot". If this is the case, I can make a smaller patch, that fixes just the name "decompression" strcpy's.


I'm surprised that using 8 markers helps anything. There should be many many more 0 stems than that in a not so big kernel.
Did you actually measure the hit rate of the cache? I bet it is pretty low.

Well, I only left in the resulting source code the pieces that I actually measured to be a significant improvment.

The thing is, this is not exactly a cache.

The problem that the markers address is that the decompression must be done sequentially.

If I have 20000 symbols and already figured out from the binary search that I need symbol 11201 (for instance), I would have to go through 11201 symbols to get to the symbol I need.

The algorithm I wrote keeps markers in the middle of the stream, so that when I try to fetch symbol 11201, I already know where symbol 10000 is because of the marker and only have to go through 1201 symbols.

With N markers you get N times the speed on the name search. (actually this is not exactly right for high values of N, because you can only use a marker that is a 0 stem, but for N<~32 this is a good approximation)

--
Paulo Marques - www.grupopie.com
"In a world without walls and fences who needs windows and gates?"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/