This ebuild seems like a good start. An openrc init script, and systemd unit file for both turning off and on the kernels KSM functionality, as well as the daemon ksmtuned, which monitors the current status of KSM and tweaks settings as needed based on a configuration file.
(In reply to Michael Jones from comment #0) > This ebuild seems like a good start. Which one? Sorry, but there's not enough info for a meaningful bugreport. Please provide at least project's homepage. Ebuild is even better.
Apologizes, the hyperlink that I thought I pasted was apparently not pasted into my original comment. https://github.com/stepping-stone/portage-overlay/tree/master/app-emulation/ksm That's the example ebuild that I was referring to. There is a daemon called ksmtuned, which has source (at least, one location of it) here: https://github.com/bzed/debian-ksmtuned