Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smp: disable mlock on overcommit #2575

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/seastar/core/reactor_config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ struct reactor_options : public program_options::option_group {
/// * \ref idle_poll_time_us = 0
/// * \ref smp_options::thread_affinity = 0
/// * \ref poll_aio = 0
/// * \ref smp_options::lock_memory = 0
program_options::value<> overprovisioned;
/// \brief Abort when seastar allocator cannot allocate memory.
program_options::value<> abort_on_seastar_bad_alloc;
Expand Down
2 changes: 2 additions & 0 deletions include/seastar/core/smp_options.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ struct smp_options : public program_options::option_group {
/// Path to accessible hugetlbfs mount (typically /dev/hugepages/something).
program_options::value<std::string> hugepages;
/// Lock all memory (prevents swapping).
///
/// Disable for overprovisioned environments.
program_options::value<bool> lock_memory;
/// Pin threads to their cpus (disable for overprovisioning).
///
Expand Down
6 changes: 3 additions & 3 deletions src/core/reactor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3814,7 +3814,7 @@ smp_options::smp_options(program_options::option_group* parent_group)
, memory(*this, "memory", std::nullopt, "memory to use, in bytes (ex: 4G) (default: all)")
, reserve_memory(*this, "reserve-memory", {}, "memory reserved to OS (if --memory not specified)")
, hugepages(*this, "hugepages", {}, "path to accessible hugetlbfs mount (typically /dev/hugepages/something)")
, lock_memory(*this, "lock-memory", {}, "lock all memory (prevents swapping)")
, lock_memory(*this, "lock-memory", {}, "lock all memory (prevents swapping). Disable for overprovisioned environments")
, thread_affinity(*this, "thread-affinity", true, "pin threads to their cpus (disable for overprovisioning)")
#ifdef SEASTAR_HAVE_HWLOC
, num_io_groups(*this, "num-io-groups", {}, "Number of IO groups. Each IO group will be responsible for a fraction of the IO requests. Defaults to the number of NUMA nodes")
Expand Down Expand Up @@ -4332,7 +4332,7 @@ void smp::configure(const smp_options& smp_opts, const reactor_options& reactor_
hugepages_path = smp_opts.hugepages.get_value();
}
auto mlock = false;
if (smp_opts.lock_memory) {
if (smp_opts.lock_memory && !reactor_opts.overprovisioned) {
mlock = smp_opts.lock_memory.get_value();
}
if (mlock) {
Expand Down Expand Up @@ -4603,7 +4603,7 @@ void smp::configure(const smp_options& smp_opts, const reactor_options& reactor_

engine().configure(reactor_opts);

if (smp_opts.lock_memory && smp_opts.lock_memory.get_value() && layout && !layout->ranges.empty()) {
if (mlock && layout && !layout->ranges.empty()) {
smp::setup_prefaulter(resources, std::move(*layout));
}
}
Expand Down
Loading