On Fri, 2023-02-10 at 23:23 +0000, Matthew Wilcox wrote:
On Fri, Feb 10, 2023 at 01:50:04PM -0800, Stefan Roesch wrote:
So far KSM can only be enabled by calling madvise for memory regions. What is required to enable KSM for more workloads is to enable / disable it at the process / cgroup level.
Use case: The madvise call is not available in the programming language. An example for this are programs with forked workloads using a garbage collected language without pointers. In such a language madvise cannot be made available.
In addition the addresses of objects get moved around as they are garbage collected. KSM sharing needs to be enabled "from the outside" for these type of workloads.
Don't you have source code to the interpreter for this mysterious language? Usually that would be where we put calls to madvise()
That same interpreter is also used for workloads where KSM brings no benefit, and we don't want the overhead of KSM.
It really would be useful to have the ability to enable this on a per workload basis, for programming languages that do not support madvise.