|
|
Subscribe / Log in / New account

kmemcheck

kmemcheck

Posted Nov 29, 2007 13:19 UTC (Thu) by dw (guest, #12017)
Parent article: kmemcheck

Doubling the size of every allocation seems pretty wasteful, couldn't a bitmap be used
instead, with byte or even word-level granularity?

new_size = (size + (size/8))


to post comments

kmemcheck

Posted Nov 29, 2007 14:44 UTC (Thu) by nix (subscriber, #2304) [Link]

A bitmap definitely can be used instead. (This is how valgrind's memcheck 
tool implements uninitialized checks, although using JIT simulation rather 
than page faulting to detect accesses.)

kmemcheck

Posted Nov 29, 2007 15:20 UTC (Thu) by jreiser (subscriber, #11027) [Link]

On a 32-bit machine it is tempting to use 8 bits (an entire byte) to track access to 32 bits
(one word) of memory.  This gives speed while still saving some space.

kmemcheck

Posted Nov 29, 2007 18:16 UTC (Thu) by felixfix (subscriber, #242) [Link] (3 responses)

The code to map bits would be slower; maybe he did not like the tradeoff.

kmemcheck

Posted Nov 29, 2007 18:41 UTC (Thu) by lysse (guest, #3190) [Link] (2 responses)

When there's already a page fault happening on every memory access, I have some doubts of the
significance of such additional overhead.

kmemcheck

Posted Nov 29, 2007 18:52 UTC (Thu) by felixfix (subscriber, #242) [Link]

Well, hmmmm, I guess I was thinking just enough to stick my foot in my mouth :-)

kmemcheck

Posted Nov 29, 2007 19:06 UTC (Thu) by nix (subscriber, #2304) [Link]

Also the extra memory accesses will tend to blow the cache more if you use 
more memory to track the uninit state.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds