On Thu, Mar 30, 2023 at 06:55:31AM +0200, David Hildenbrand wrote: > On 29.03.23 01:09, Andrew Morton wrote: > > On Fri, 10 Mar 2023 10:28:48 -0800 Stefan Roesch <shr@xxxxxxxxxxxx> wrote: > > > > > So far KSM can only be enabled by calling madvise for memory regions. To > > > be able to use KSM for more workloads, KSM needs to have the ability to be > > > enabled / disabled at the process / cgroup level. > > > > Review on this series has been a bit thin. Are we OK with moving this > > into mm-stable for the next merge window? > > I still want to review (traveling this week), but I also don't want to block > this forever. > > I think I didn't get a reply from Stefan to my question [1] yet (only some > comments from Johannes). I would still be interested in the variance of > pages we end up de-duplicating for processes. > > The 20% statement in the cover letter is rather useless and possibly > misleading if no details about the actual workload are shared. The workload is instagram. It forks off Django runtimes on-demand until it saturates whatever hardware it's running on. This benefits from merging common heap/stack state between instances. Since that runtime is quite large, the 20% number is not surprising, and matches our expectations of duplicative memory between instances. Obviously we could spend months analysing which exact allocations are identical, and then more months or years reworking the architecture to deduplicate them by hand and in userspace. But this isn't practical, and KSM is specifically for cases where this isn't practical. Based on your request in the previous thread, we investigated whether the boost was coming from the unintended side effects of KSM splitting THPs. This wasn't the case. If you have other theories on how the results could be bogus, we'd be happy to investigate those as well. But you have to let us know what you're looking for. Beyond that, I don't think we need to prove from scratch that KSM can be a worthwhile optimization. It's been established that it can be. This series is about enabling it in scenarios where madvise() isn't practical, that's it, and it's yielding the expected results.