Add osd_memlock option
parent
20ee4ed758
commit
73ae578981
|
@ -329,3 +329,13 @@
|
||||||
info_ru: |
|
info_ru: |
|
||||||
Минимальная применимая к ограничиваемым операциям задержка. Обычно не
|
Минимальная применимая к ограничиваемым операциям задержка. Обычно не
|
||||||
требует изменений.
|
требует изменений.
|
||||||
|
- name: osd_memlock
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
|
info: >
|
||||||
|
Lock all OSD memory to prevent it from being unloaded into swap with
|
||||||
|
mlockall(). Requires sufficient ulimit -l (max locked memory).
|
||||||
|
info_ru: >
|
||||||
|
Блокировать всю память OSD с помощью mlockall, чтобы запретить её выгрузку
|
||||||
|
в пространство подкачки. Требует достаточного значения ulimit -l (лимита
|
||||||
|
заблокированной памяти).
|
||||||
|
|
|
@ -104,6 +104,7 @@ const etcd_tree = {
|
||||||
no_rebalance: false,
|
no_rebalance: false,
|
||||||
print_stats_interval: 3,
|
print_stats_interval: 3,
|
||||||
slow_log_interval: 10,
|
slow_log_interval: 10,
|
||||||
|
osd_memlock: false,
|
||||||
// blockstore - fixed in superblock
|
// blockstore - fixed in superblock
|
||||||
block_size,
|
block_size,
|
||||||
disk_alignment,
|
disk_alignment,
|
||||||
|
|
11
src/osd.cpp
11
src/osd.cpp
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
@ -53,6 +54,16 @@ osd_t::osd_t(const json11::Json & config, ring_loop_t *ringloop)
|
||||||
autosync_writes = max_autosync;
|
autosync_writes = max_autosync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->config["osd_memlock"] == "true" || this->config["osd_memlock"] == "1" || this->config["osd_memlock"] == "yes")
|
||||||
|
{
|
||||||
|
// Lock all OSD memory if requested
|
||||||
|
if (mlockall(MCL_CURRENT|MCL_FUTURE|MCL_ONFAULT) != 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "osd_memlock is set to true, but mlockall() failed: %s\n", strerror(errno));
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->tfd->set_timer(print_stats_interval*1000, true, [this](int timer_id)
|
this->tfd->set_timer(print_stats_interval*1000, true, [this](int timer_id)
|
||||||
{
|
{
|
||||||
print_stats();
|
print_stats();
|
||||||
|
|
Loading…
Reference in New Issue