Izik Eidus wrote:
I belive using ioctl for registering memory of applications make it
easier....
Yes, I completely agree.
Ksm doesnt have any complicated API that would benefit from sysfs
(beside adding more complexity)
That is, the KSM_START_STOP_KTHREAD part, not necessarily the rest of
the API.
What you mean?
The ioctl(KSM_START_STOP_KTHREAD) API is distinct from the rest of the
API. Whereas the rest of the API is used by applications to register
their memory with KSM, this API is used by ksmctl to allow parameters to
be tweaked in userspace.
These parameters are just simple values like enable, pages_to_scan,
sleep_time. Then there is KSM_GET_INFO_KTHREAD which provides a read
interface to these parameters.
You could drop KSM_START_STOP_KTHREAD and KSM_GET_INFO_KTHREAD
altogether, and introduce a sysfs hierarchy:
/sysfs/<some/path>/ksm/{enable,pages_to_scan,sleep_time}
That eliminates the need for ksmctl altogether, cleanly separates the
two APIs, and provides a stronger interface.
The main problem with the current API is that it uses a single device to
do both the administrative task and the userspace interface. That means
that any application that has access to registering its memory with KSM
also has the ability to disable KSM. That seems like a security concern
to me since registering a memory region ought to be an unprivileged
action whereas enabling/disabling KSM ought to be a privileged action.
Regards,
Anthony Liguori
Regards,
Anthony Liguori
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html