On Thu, Oct 31, 2024 at 05:37:12PM +0300, Stepanov Anatoly wrote: > Don't get us wrong, we're not trying to push this into memcg specifically. > We're just trying to find a proper/friendly way to control > THP mode for a group of processes (which can be tasks without common parent). > > May be if the process grouping logic were decoupled from hierarchical resource control > logic, it could be possible to gather multiple process, and batch-control some task properties. > But it would require to build kind of task properties system, where > a given set of properties can be flexibly assigned to one or more tasks. > > Anyway, i think we gonna try alternative > approaches first.(prctl, process_madvise). I oppose all of these approaches. They are fundamentally misguided. You're trying to blame sysadmins for our inadequacies as programmers. All of this should be automatic. Certainly the kernel will make mistakes and not use the perfectly optimal size at all times, but it should be able to get close to optimal. Please, focus your efforts on allocating memory of the right size, not on this fake problem of "we only have 235 THPs available and we must make sure that the right process gets 183 of them".