From db88632456cfb8dacc5f7bbfb70ad039bf424573 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 10 Dec 2014 20:03:28 +0200 Subject: [PATCH] reactor: wire up hugetlbfs support --- core/reactor.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/reactor.cc b/core/reactor.cc index 31f84f2510..d7545fb272 100644 --- a/core/reactor.cc +++ b/core/reactor.cc @@ -848,6 +848,7 @@ smp::get_options_description() ("smp,c", bpo::value()->default_value(cpus), "number of threads") ("memory,m", bpo::value(), "memory to use, in bytes (ex: 4G) (default: all)") ("reserve-memory", bpo::value()->default_value("512M"), "memory reserved to OS") + ("hugepages", bpo::value(), "path to accessible hugetlbfs mount (typically /dev/hugepages/something)") ; return opts; } @@ -885,10 +886,14 @@ void smp::configure(boost::program_options::variables_map configuration) if (configuration.count("reserve-memory")) { rc.reserve_memory = parse_memory_size(configuration["reserve-memory"].as()); } + std::experimental::optional hugepages_path; + if (configuration.count("hugepages")) { + hugepages_path = configuration["hugepages"].as(); + } rc.cpus = smp::count; std::vector allocations = resource::allocate(rc); pin_this_thread(allocations[0].cpu_id); - memory::configure(allocations[0].mem); + memory::configure(allocations[0].mem, hugepages_path); smp::_qs = new smp_message_queue* [smp::count]; for(unsigned i = 0; i < smp::count; i++) { smp::_qs[i] = new smp_message_queue[smp::count]; @@ -900,9 +905,9 @@ void smp::configure(boost::program_options::variables_map configuration) for (unsigned i = 1; i < smp::count; i++) { auto allocation = allocations[i]; - _threads.emplace_back([configuration, i, allocation] { + _threads.emplace_back([configuration, hugepages_path, i, allocation] { pin_this_thread(allocation.cpu_id); - memory::configure(allocation.mem); + memory::configure(allocation.mem, hugepages_path); sigset_t mask; sigfillset(&mask); auto r = ::sigprocmask(SIG_BLOCK, &mask, NULL);