pahole - Finding holes in kernel structs

Robert Watson rwatson at FreeBSD.org
Thu Feb 12 09:55:11 PST 2009


On Thu, 12 Feb 2009, Max Laier wrote:

>>> So to answer your first question, submitting 101 patches to rearrange 101 
>>> structs is certainly a wasted effort.  However, if you take a good look at 
>>> the 2000 holes, identify an interesting subset and submit a patch to fix 
>>> that subset ... that would be a worthwhile effort ... IMHO.
>>
>> The other thing to keep in mind is that structure layout can have a 
>> noticeable effect on cache locality.  Arbitrarily rearranging structure 
>> members can generate many more cache misses so one should sanity check 
>> changes w/ something like hwpmc.  However as noted because layout may be 
>> platform-dependent even if something shows no change on x86 it may be a 
>> loss on another architecture and finding that performance drop may be 
>> really hard.
>
> Let's not be too "glass half empty" about it, though.  The same is true in 
> the opposite direction.  If we can identify and eliminate an unnecessary 
> hole in an important structure we might gain that same performance just by 
> reshuffling a few lines.

Well, I think we want to inform this through actual measurement.  Right now, 
tools like hwpmc track cache misses by point in executable code, but what 
would be nice is if we could post-process to generate cache miss information 
by data structure field...

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the freebsd-hackers mailing list