On Tue, Nov 22, 2022, at 17:59, Vlastimil Babka wrote: > On 11/22/22 17:33, Arnd Bergmann wrote: >> On Mon, Nov 21, 2022, at 18:11, Vlastimil Babka wrote: >> I can imagine those machines wanting to use sysfs in general >> but not for the slab caches, so having a separate knob to >> configure out the sysfs stuff could be useful without having >> to go all the way to SLUB_TINY. > > Right, but AFAIK that wouldn't save much except some text size and kobjects, > so probably negligible for >32MB? Makes sense, I assume you have a better idea of how much this could save. I'm not at all worried about the .text size, but my initial guess was that the metadata for sysfs would be noticeable. >> For the options that trade off performance against lower >> fragmentation (MIN/MAX_PARTIAL, KMALLOC_RECLAIM, percpu >> slabs), I wonder if it's possible to have a boot time >> default based on the amount of RAM per CPU to have a better >> tuned system on most cases, rather than having to go >> to one extreme or the other at compile time. > > Possible for some of these things, but for others that brings us back to the > question what are the actual observed issues. If it's low memory in absolute > number of pages, these can help, but if it's fragmentation (and the kind if > RAM sizes should have page grouping by mobility enabled), ditching e.g. the > KMALLOC_RECLAIM could make it worse. Unfortunately some of these tradeoffs > can be rather unpredictable. Are there any obvious wins on memory uage? I would guess that it would be safe to e.g. ditch percpu slabs when running with less 128MB per CPU, and the MIN/MAX_PARTIAL values could easily be a function of the number of pages in total or per cpu, whichever makes most sense. As a side-effect, those could also grow slightly larger on huge systems by scaling them with log2(totalpages). Arnd