Ksmd support merge_across_node on/off

Ref: https://github.com/harvester/harvester/issues/2827

image image

Verify Steps:

  1. Install Harvester with any nodes
  2. Login to Dashboard and Navigate to hosts
  3. Edit node1’s Ksmtuned to Run and ThresCoef to 85 then Click Save
  4. Login to node1’s console, execute kubectl get ksmtuned -oyaml --field-selector metadata.name=<node1>
  5. Fields in spec should be the same as Dashboard configured
  6. Create an image for VM creation
  7. Create multiple VMs with 2Gi+ memory and schedule on <node1> (memory size reflect to ’s maximum size, total of VMs’ memory should greater than 40%)
  8. Execute watch -n1 grep . /sys/kernel/mm/ksm/* to monitor ksm’s status change
    • /sys/kernel/mm/ksm/run should be update to 1 after VMs started
    • /sys/kernel/mm/ksm/page_* should updating continuously
  9. Login to Dashboard then navigate to Hosts, click
  10. In the Tab of Ksmtuned, values in Statistics section should not be 0. (data in this section will be updated per min, so it not equals to console’s output was expected.)
  11. Update ’s Ksmtuned to check Enable Merge Across Nodes
  12. Monitor data in Step.8 should reflect to:
    • /sys/kernel/mm/ksm/run should be updated to 2
    • /sys/kernel/mm/ksm/pages_* should be updated to 0
  13. Restart all VMs scheduling to <node1>
  14. Monitor data in Step.8 should reflect to:
    • /sys/kernel/mm/ksm/run should be updated to 1
    • /sys/kernel/mm/ksm/pages_* should be updated and less than Step.8 monitored