google / kernel-sanitizers

Linux Kernel Sanitizers, fast bug-detectors for the Linux kernel
https://google.github.io/kernel-sanitizers/
436 stars 87 forks source link

More fixes for v2, address long-lived objects in special caches #146

Closed melver closed 4 years ago

melver commented 4 years ago

This seems to work really well, at least for the sysbench I/O workload. My guess is that most of these pathological allocations should all be via special caches.

dvyukov commented 4 years ago

This looks premature to me. It maybe like speeding up a benchmark, but slowing down production workload. Custom caches have lots of transient allocations and kmalloc caches can well have persistent allocations...

melver commented 4 years ago

This looks premature to me. It maybe like speeding up a benchmark, but slowing down production workload. Custom caches have lots of transient allocations and kmalloc caches can well have persistent allocations...

This is not related to performance. It didn't speed up the benchmark. It ensured that it doesn't exhaust the memory pool.

The fact is still, that many of those long-lived allocation (like for I/O caches) come from custom caches. The cut-off also only kicks in after we reach e.g. 80% of usage, so we still get plenty of KFENCE allocations for those custom caches.

melver commented 4 years ago

I have mixed feelings about these patches. It will be hard to remove this knob once people start depending on it. Also, despite kmalloc caches are more generic, I don't think we have enough data to say that most bugs are in the code using kmalloc.

This makes sense, and is something I can get behind.

I just wanted to throw it out there, since we were discussing it and this is one option. And given the feedback, it seems we agree we can live without special tweaks and hacks for long-lived objects for now. :-)