mirror of
git://sourceware.org/git/lvm2.git
synced 2024-11-11 23:22:05 +03:00
memlock: use value of 0 to disable memory locking
In cases user is sure he is not using his 'rootfs' or 'swap' on LVs managed with his command - it possible to completely bypass pinning process to RAM which may eventually slightly speedup command execution, (however at the risk the process can be eventually delayed by swapping). Basicaly use this only at your risk... TODO: add some dmeventd support for this.
This commit is contained in:
parent
7e2bb2a35e
commit
964012fdb9
@ -1424,11 +1424,14 @@ cfg(activation_use_linear_target_CFG, "use_linear_target", activation_CFG_SECTIO
|
||||
|
||||
cfg(activation_reserved_stack_CFG, "reserved_stack", activation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_RESERVED_STACK, vsn(1, 0, 0), NULL, 0, NULL,
|
||||
"Stack size in KiB to reserve for use while devices are suspended.\n"
|
||||
"Insufficient reserve risks I/O deadlock during device suspension.\n")
|
||||
"Insufficient reserve risks I/O deadlock during device suspension.\n"
|
||||
"Value 0 disables memory locking.\n")
|
||||
|
||||
cfg(activation_reserved_memory_CFG, "reserved_memory", activation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_RESERVED_MEMORY, vsn(1, 0, 0), NULL, 0, NULL,
|
||||
"Memory size in KiB to reserve for use while devices are suspended.\n"
|
||||
"Insufficient reserve risks I/O deadlock during device suspension.\n")
|
||||
"Insufficient reserve risks I/O deadlock during device suspension.\n"
|
||||
"Value 0 disables memory locking.\n")
|
||||
|
||||
|
||||
cfg(activation_process_priority_CFG, "process_priority", activation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_PROCESS_PRIORITY, vsn(1, 0, 0), NULL, 0, NULL,
|
||||
"Nice value used while devices are suspended.\n"
|
||||
|
@ -517,6 +517,13 @@ static void _restore_priority_if_possible(struct cmd_context *cmd)
|
||||
/* Stop memory getting swapped out */
|
||||
static void _lock_mem(struct cmd_context *cmd)
|
||||
{
|
||||
if (!_size_stack || _size_malloc_tmp) {
|
||||
log_debug_mem("Skipping memory locking (reserved memory: "
|
||||
FMTsize_t " stack: " FMTsize_t ").",
|
||||
_size_malloc_tmp, _size_stack);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cmd->running_on_valgrind)
|
||||
_allocate_memory();
|
||||
(void)strerror(0); /* Force libc.mo load */
|
||||
@ -557,6 +564,13 @@ static void _unlock_mem(struct cmd_context *cmd)
|
||||
{
|
||||
size_t unlock_mstats = 0;
|
||||
|
||||
if (!_size_stack || _size_malloc_tmp) {
|
||||
log_debug_mem("Skipping memory unlocking (reserved memory: "
|
||||
FMTsize_t " stack: " FMTsize_t ").",
|
||||
_size_malloc_tmp, _size_stack);
|
||||
return;
|
||||
}
|
||||
|
||||
log_very_verbose("Unlocking memory");
|
||||
|
||||
if (!_memlock_maps(cmd, LVM_MUNLOCK, &unlock_mstats))
|
||||
|
Loading…
Reference in New Issue
Block a user