The transparent huge page shrinker
The transparent huge page shrinker
Posted Sep 13, 2022 16:17 UTC (Tue) by WolfWings (subscriber, #56790)In reply to: The transparent huge page shrinker by jtaylor
Parent article: The transparent huge page shrinker
The other long-standing issue has been software using jemalloc which doesn't actually 'free' memory when it's done with it most of the time but just uses MADV_DONTNEED and MADV_FREE so it ends up actively fighting with khugepaged which then re-faults those 'all zero' pages to merge them together again since they're still tied to the process.
So in effect software using jemalloc with THP enabled and lots of small allocations and frees would suddenly have the worst-case "lots of wasted RAM" situation almost immediately.
It's also why so much jemalloc-using software has a much higher resident size quite often is from all of those "I'm done with these... but I won't pay the memory-fault costs to actually free them (BENCHMARKS, AHOY!) so I'll use the lazy-free madvise call instead" situations.