ComfyUI Extension: comfyui-process-ksm

Authored by Nuitari

Created

Updated

0 stars

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

A simple ComfyUI custom node to enable Kernel Samepage Merging (KSM) on Linux, allowing memory deduplication to reduce RAM usage depending on workload.

Looking for a different extension?

Custom Nodes (1)

README

This is a simple ComfyUI custom node to enable KSM on Linux. KSM is a feature that tells the Linux Kernel to deduplicate memory pages. This can save RAM, but the savings will vary depending on the workload.

You will need to enable KSM: echo 1 | sudo tee /sys/kernel/mm/ksm/run

This will make KSM scan more aggresively: echo 5000 | sudo tee /sys/kernel/mm/ksm/pages_to_scan

You can monitor /sys/kernel/mm/ksm/general_profit to see how much memory KSM saved.

If it is negative, then the overhead of having KSM outweights the savings.

This can work even if you only have one instance of ComfyUI running, but don't expect much in savings.

The action is in init.py where it tells the kernel that any subsequent memory allocation for the process is to be considered as shareable pages.

You can use the node "Enable Process KSM" to get stats as part of your workflow and to validate that it is enabled.

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Learn more