add support for KSM
This adds support for KSM (kernel samepage merging). It adds a new boolean parameter called MemoryKSM to enable the feature. The feature can only be enabled with newer kernels.
This commit is contained in:
committed by
Lennart Poettering
parent
308b189511
commit
85614c6e2f
@@ -5193,6 +5193,16 @@ static int exec_child(
|
||||
return r;
|
||||
}
|
||||
|
||||
if (context->memory_ksm >= 0)
|
||||
if (prctl(PR_SET_MEMORY_MERGE, context->memory_ksm) < 0) {
|
||||
if (ERRNO_IS_NOT_SUPPORTED(errno))
|
||||
log_unit_debug_errno(unit, errno, "KSM support not available, ignoring.");
|
||||
else {
|
||||
*exit_status = EXIT_KSM;
|
||||
return log_unit_error_errno(unit, errno, "Failed to set KSM: %m");
|
||||
}
|
||||
}
|
||||
|
||||
/* Drop groups as early as possible.
|
||||
* This needs to be done after PrivateDevices=y setup as device nodes should be owned by the host's root.
|
||||
* For non-root in a userns, devices will be owned by the user/group before the group change, and nobody. */
|
||||
@@ -5773,6 +5783,7 @@ void exec_context_init(ExecContext *c) {
|
||||
c->tty_cols = UINT_MAX;
|
||||
numa_policy_reset(&c->numa_policy);
|
||||
c->private_mounts = -1;
|
||||
c->memory_ksm = -1;
|
||||
}
|
||||
|
||||
void exec_context_done(ExecContext *c) {
|
||||
|
||||
Reference in New Issue
Block a user