[Unit]
Description=Kernel Samepage Merging
ConditionPathExists=/sys/kernel/mm/ksm
ConditionVirtualization=no

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/sysconfig/ksm
ExecStart=/lib/systemd/ksmctl start
ExecStop=/lib/systemd/ksmctl stop

[Install]
WantedBy=multi-user.target