enb - log warning when rnti-specific memory block is full

master
Francisco 4 years ago committed by Francisco Paisana
parent a890a22ccd
commit 71f1f1b556

@ -39,7 +39,8 @@ class circular_stack_pool
public:
circular_stack_pool(size_t nof_objs_per_batch, size_t stack_size, size_t batch_thres, int initial_size = -1) :
central_cache(std::min(NofStacks, nof_objs_per_batch), stack_size, batch_thres, initial_size)
central_cache(std::min(NofStacks, nof_objs_per_batch), stack_size, batch_thres, initial_size),
logger(srslog::fetch_basic_logger("POOL"))
{}
circular_stack_pool(circular_stack_pool&&) = delete;
circular_stack_pool(const circular_stack_pool&) = delete;
@ -66,13 +67,18 @@ public:
if (not elem.alloc.is_init()) {
void* block = central_cache.allocate_node(central_cache.get_node_max_size());
if (block == nullptr) {
logger.warning("Failed to allocate memory block from central cache");
return nullptr;
}
elem.key = key;
elem.alloc = linear_allocator(block, central_cache.get_node_max_size());
}
void* ptr = elem.alloc.allocate(size, alignment);
if (ptr == nullptr) {
logger.warning("No space left in memory block with key=%zd of circular stack pool", key);
} else {
elem.count++;
}
return ptr;
}
@ -98,6 +104,7 @@ public:
private:
srsran::circular_array<mem_block_elem_t, NofStacks> pools;
srsran::background_mem_pool central_cache;
srslog::basic_logger& logger;
};
} // namespace srsran

@ -44,11 +44,12 @@ public:
void* allocate(size_t sz, size_t alignment)
{
void* alloc_start = align_to(cur, alignment);
cur = static_cast<uint8_t*>(alloc_start) + sz;
srsran_assert(cur <= end,
"Linear Allocator buffer of size=%zd was exceeded (current size=%zd)",
size(),
nof_bytes_allocated());
uint8_t* new_cur = static_cast<uint8_t*>(alloc_start) + sz;
if (new_cur > end) {
// Cannot fit allocation in memory block
return nullptr;
}
cur = new_cur;
return alloc_start;
}

@ -514,6 +514,7 @@ int main(int argc, char* argv[])
srslog::init();
srslog::fetch_basic_logger("ALL").set_level(srslog::basic_levels::warning);
srslog::fetch_basic_logger("POOL").set_level(srslog::basic_levels::warning);
srsran::log_args(argc, argv, "ENB");
srsran::check_scaling_governor(args.rf.device_name);

Loading…
Cancel
Save