From 0b91598e361bb4137eaad96709d82dee6f9a6008 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Mon, 3 May 2021 11:01:09 +0200 Subject: [PATCH] Move mlockall() to main() in srsUE and srsENB --- srsenb/src/main.cc | 5 +++++ srsenb/src/phy/phy.cc | 3 --- srsue/src/main.cc | 5 +++++ srsue/src/phy/phy.cc | 2 -- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index a4e56f6cb..c8a842dc7 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "srsran/common/common_helper.h" @@ -534,6 +535,10 @@ int main(int argc, char* argv[]) event_logger::configure(json_channel); } + if (mlockall((uint32_t)MCL_CURRENT | (uint32_t)MCL_FUTURE) == -1) { + srsran::console("Failed to `mlockall`: {}", errno); + } + // Create eNB unique_ptr enb{new srsenb::enb(srslog::get_default_sink())}; if (enb->init(args) != SRSRAN_SUCCESS) { diff --git a/srsenb/src/phy/phy.cc b/srsenb/src/phy/phy.cc index f1f8cb535..8bbe4f712 100644 --- a/srsenb/src/phy/phy.cc +++ b/srsenb/src/phy/phy.cc @@ -15,7 +15,6 @@ #include #include #include -#include #include #include "srsenb/hdr/phy/phy.h" @@ -105,8 +104,6 @@ int phy::init(const phy_args_t& args, return SRSRAN_ERROR; } - mlockall((uint32_t)MCL_CURRENT | (uint32_t)MCL_FUTURE); - // Add PHY lib log. srslog::basic_levels log_lvl = srslog::str_to_basic_level(args.log.phy_lib_level); diff --git a/srsue/src/main.cc b/srsue/src/main.cc index f6f993de5..215b25b9a 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include extern bool simulate_rlf; @@ -675,6 +676,10 @@ int main(int argc, char* argv[]) srsran::check_scaling_governor(args.rf.device_name); + if (mlockall((uint32_t)MCL_CURRENT | (uint32_t)MCL_FUTURE) == -1) { + fprintf(stderr, "Failed to `mlockall`: %d", errno); + } + // Create UE instance. srsue::ue ue; if (ue.init(args)) { diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index 694fa6444..f0116863a 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -11,7 +11,6 @@ */ #include -#include #include "srsran/common/band_helper.h" #include "srsran/common/standard_streams.h" @@ -104,7 +103,6 @@ int phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srsran:: int phy::init(const phy_args_t& args_) { std::unique_lock lock(config_mutex); - mlockall(MCL_CURRENT | MCL_FUTURE); args = args_;