Re: [PATCH] kmemcheck: don't track pages allocated with interrupts disabled

From: Vegard Nossum
Date: Sat Jun 07 2008 - 16:20:19 EST


On Sat, Jun 7, 2008 at 9:47 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
>
>> Maybe we can do the splitting when kmemcheck is enabled for the first
>> time, either with the proc handler or at boot if kmemcheck=1 is passed
>> on the command line. Both of these contexts should/can be
>> !irqs_disabled(), I think.
>
> You could always split at boot when the CONFIG is enabled. I assume the
> CONFIG alone has already quite a lot of overhead and it will be only
> on in debug kernels and adding some more TLB misses shouldn't be really
> a problem. Using 2MB pages in kernel is merely an optimization.

Actually, no, the CONFIG itself is now very low overhead. The only
thing we do is a very simple check in the slab allocator each time you
allocate or free an object (it's a couple of if()s, I doubt it would
show up in anything but microbenchmarks). These is also maybe two or
three calls for each page fault, but they return very quickly.

I didn't test, but this should be the only penalty of enabling the
CONFIG. Of course, once you pass kmemcheck=1 at boot it will be a
disaster :-)

But you are probably right nevertheless; the overhead of 4K pages
instead 2M is probably negligible in most cases.


Vegard

--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
--
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/