On Wed, May 25, 2022 at 1:56 PM Vlastimil Babka <vbabka@xxxxxxx> wrote: > > As I understand it's a tradeoff between memory overhead due to hash > table size and cpu overhead due to length of collision chains. ... but why is that a build-time kernel config question? And when does it actually end up triggering? I didn't much care - and clearly small machines like m68k didn't either - when the whole stackdepot thing was a "odd configuration issue". Because it used to be that stack depot users were fairly easy to figure out. It was all about pretty special debug options that enable a lot of very special code (KASAN and PAGE_OWNER - is there anything else?). Very clearly just debug builds. But this slab change means that now it's basically *always* enabled as an option, and that means that now it had better do sane things because it's enabled by default and not something that can easily be ignored any more. The kernel config phase is something I'm very sensitive to, because honestly, it's just about the worst part of building a kernel. Everything else is pretty easy. The kernel config is painful. That means that we should not ask insane questions - and asking what static size you want for a data structure that 99% of all people have absolutely _zero_ idea about or interest in is wrong. So the problem here is two-fold: (a) it introduces a new compile-time question that isn't sane to ask a regular user, but is now exposed to regular users. (b) this by default uses 1MB of memory for a feature that didn't in the past, so now if you have small machines you need to make sure you make a special kernel config for them. And (a) happens unconditionally, while (b) is conditional. And it's now clear exactly what all triggers the actual allocation in (b). I _hope_ it's never triggered unless you actively enable slub debug, but at least from a quick grep it wasn't obvious. For example, if you happen to have rcutorture enabled, do you get the allocation then just because rcutorture uses kcp = kmem_cache_create("rcuscale", 136, 8, SLAB_STORE_USER, NULL); even if you have nothing else that would enable slaub debugging? It *looked* that way to me from a quick grep, but I could easily have missed something. Linus