Skip to content

Commit 4ea80bd

Browse files
saukaPavel Harbanau
authored andcommitted
gnb: fix crash in affinity_manager when default settings are used
1 parent 468b8ad commit 4ea80bd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

apps/gnb/gnb_worker_manager.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class affinity_mask_manager
2929
public:
3030
/// Creates the tuned affinity mask manager with the given number of threads per core, reserves given amount of CPU
3131
/// cores for non priority tasks.
32-
explicit affinity_mask_manager(unsigned nof_threads_per_core_ = 2U, unsigned nof_cores_for_non_prio_threads_ = 4U) :
32+
explicit affinity_mask_manager(unsigned nof_threads_per_core_, unsigned nof_cores_for_non_prio_threads_) :
3333
nof_threads_per_core(nof_threads_per_core_),
3434
nof_cores_for_non_prio_threads(nof_cores_for_non_prio_threads_),
3535
cpu_bitset(compute_host_nof_hardware_threads())
@@ -44,6 +44,15 @@ class affinity_mask_manager
4444
cpu_bitset.fill(0, nof_cores_for_non_prio_threads, true);
4545
}
4646

47+
/// Default constructor.
48+
affinity_mask_manager() :
49+
nof_threads_per_core(2U),
50+
nof_cores_for_non_prio_threads(compute_host_nof_hardware_threads() / 2),
51+
cpu_bitset(compute_host_nof_hardware_threads())
52+
{
53+
cpu_bitset.fill(0, nof_cores_for_non_prio_threads, true);
54+
}
55+
4756
/// \brief Returns an affinity mask with assigned CPU indexes.
4857
///
4958
/// \param name Name of the task trying to reserve a CPU core.

0 commit comments

Comments
 (0)