Skip to content

Commit ec15763

Browse files
committed
support: remove lockfree stack from repository
1 parent 7735a56 commit ec15763

File tree

4 files changed

+7
-436
lines changed

4 files changed

+7
-436
lines changed

include/srsran/support/memory_pool/fixed_size_memory_block_pool.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#pragma once
1212

1313
#include "cameron314/concurrentqueue.h"
14-
#include "lockfree_object_pool.h"
1514
#include "memory_block_list.h"
1615
#include "srsran/adt/static_vector.h"
1716
#include "srsran/support/error_handling.h"
@@ -66,6 +65,12 @@ class fixed_size_memory_block_pool
6665
/// Thread-local cache that stores a list of batches of memory blocks.
6766
using local_cache_type = static_vector<memory_block_batch, MAX_LOCAL_BATCH_CAPACITY>;
6867

68+
// Given that we use the MPMC queue in https://github.com/cameron314/concurrentqueue, we have to over-dimension it
69+
// to account the potential number of producers. The way to exactly over-dimension this queue is inconvenient, so
70+
// we just try to conservatively ensure it can accommodate up to 32 producers for a block size of 32. If this is
71+
// not enough, the queue will resize itself and malloc in the process.
72+
const static size_t OVER_DIM_CENTRAL_CACHE = 2 * 32 * 32;
73+
6974
/// Ctor of the memory pool. It is set as private because the class works as a singleton.
7075
explicit fixed_size_memory_block_pool(size_t nof_blocks_, size_t memory_block_size_) :
7176
// Make sure that there are no gaps between blocks when they are allocated as paret of a single array.
@@ -79,11 +84,7 @@ class fixed_size_memory_block_pool
7984
// Allocate the required memory for the given number of segments and segment size.
8085
allocated_memory(mblock_size * nof_blocks),
8186
// Pre-reserve space in the central cache to hold all batches and avoid reallocations.
82-
// Given that we use the MPMC queue in https://github.com/cameron314/concurrentqueue, we have to over-dimension it
83-
// to account the potential number of producers. The way to exactly over-dimension this queue is inconvenient, so
84-
// we just try to conservatively ensure it can accommodate up to 32 producers for a block size of 32. If this is
85-
// not enough, the queue will resize itself and malloc in the process.
86-
central_mem_cache(nof_total_batches() + 2 * 32 * 32)
87+
central_mem_cache(nof_total_batches() + OVER_DIM_CENTRAL_CACHE)
8788
{
8889
srsran_assert(nof_blocks > max_local_cache_size(),
8990
"The number of segments in the pool must be much larger than the thread cache size ({} <= {})",

include/srsran/support/memory_pool/lockfree_object_pool.h

Lines changed: 0 additions & 221 deletions
This file was deleted.

tests/unittests/support/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ target_link_libraries(fixed_size_memory_pool_test srsran_support gtest gtest_mai
6969
add_test(fixed_size_memory_pool_test fixed_size_memory_pool_test)
7070
set_tests_properties(fixed_size_memory_pool_test PROPERTIES LABELS "tsan")
7171

72-
add_executable(lockfree_object_pool_test lockfree_object_pool_test.cpp)
73-
target_link_libraries(lockfree_object_pool_test srsran_support gtest gtest_main)
74-
add_test(lockfree_object_pool_test lockfree_object_pool_test)
75-
set_tests_properties(lockfree_object_pool_test PROPERTIES LABELS "tsan")
76-
7772
add_executable(units_test units_test.cpp)
7873
target_link_libraries(units_test srslog srsran_support gtest gtest_main)
7974
add_test(units_test units_test)

0 commit comments

Comments
 (0)