Skip to content

Commit

Permalink
issue: 3925885 Adjusting XLIO default allocation logic
Browse files Browse the repository at this point in the history
- Modified the default ring allocation logic from ‘ring per interface’ to ‘ring per thread’.
- Adjusted the MCE_SPEC_NGINX_DPU and MCE_SPEC_NGINX by setting ring_allocation_logic_tx and
  ring_allocation_logic_rx to ‘ring per interface’.
- Fixed a minor side-effect in the ring_allocation_logic constructor.
- Disable progress engine by default to avoid performance degradation with per-thread
allocation logic.

Signed-off-by: Bashar Abdelgafer  <babdelgafer@nvidia.com>
  • Loading branch information
BasharRadya committed Jun 27, 2024
1 parent 5faae56 commit 3480fb3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/core/dev/net_device_val.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@
#define nd_logfunc __log_info_func
#define nd_logfuncall __log_info_funcall

// The value assigned in this constructor is alwys overriden later
ring_alloc_logic_attr::ring_alloc_logic_attr()
: m_ring_alloc_logic(RING_LOGIC_PER_INTERFACE)
: m_ring_alloc_logic(RING_LOGIC_PER_THREAD)
, m_use_locks(true)
, m_user_id_key(0)
{
Expand Down
4 changes: 1 addition & 3 deletions src/core/dev/ring_allocation_logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ ring_allocation_logic::ring_allocation_logic(ring_logic_t allocation_logic,
, m_migration_try_count(ring_migration_ratio)
, m_source(source)
{
if (ring_profile.get_ring_alloc_logic() == RING_LOGIC_PER_INTERFACE) {
ring_profile.set_ring_alloc_logic(allocation_logic);
}
ring_profile.set_ring_alloc_logic(allocation_logic);
m_res_key = resource_allocation_key(ring_profile);
m_migration_candidate = 0;
m_res_key.set_user_id_key(calc_res_key_by_logic());
Expand Down
4 changes: 4 additions & 0 deletions src/core/util/sys_vars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,8 @@ void mce_sys_var::get_env_params()

#ifdef DEFINED_NGINX
case MCE_SPEC_NGINX:
ring_allocation_logic_tx = RING_LOGIC_PER_INTERFACE;
ring_allocation_logic_rx = RING_LOGIC_PER_INTERFACE;
memory_limit = (app.workers_num > 16 ? 3072LU : 4096LU) * 1024 * 1024;
memory_limit *= std::max(app.workers_num, 1);
rx_bufs_batch = 8; // MCE_DEFAULT_RX_BUFS_BATCH (64), RX buffers batch size.
Expand Down Expand Up @@ -1081,6 +1083,8 @@ void mce_sys_var::get_env_params()
break;

case MCE_SPEC_NGINX_DPU:
ring_allocation_logic_tx = RING_LOGIC_PER_INTERFACE;
ring_allocation_logic_rx = RING_LOGIC_PER_INTERFACE;
// The top part is different from NGINX SPEC
memory_limit = (app.workers_num == 16 ? 512LU : 1024LU) * 1024 * 1024;
memory_limit *= std::max(app.workers_num, 1);
Expand Down
6 changes: 3 additions & 3 deletions src/core/util/sys_vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ extern mce_sys_var &safe_mce_sys();
#define MCE_DEFAULT_HANDLE_SIGINTR (true)
#define MCE_DEFAULT_HANDLE_SIGFAULT (false)
#define MCE_DEFAULT_STATS_FD_NUM 0
#define MCE_DEFAULT_RING_ALLOCATION_LOGIC_TX (RING_LOGIC_PER_INTERFACE)
#define MCE_DEFAULT_RING_ALLOCATION_LOGIC_RX (RING_LOGIC_PER_INTERFACE)
#define MCE_DEFAULT_RING_ALLOCATION_LOGIC_TX (RING_LOGIC_PER_THREAD)
#define MCE_DEFAULT_RING_ALLOCATION_LOGIC_RX (RING_LOGIC_PER_THREAD)
#define MCE_DEFAULT_RING_MIGRATION_RATIO_TX (-1)
#define MCE_DEFAULT_RING_MIGRATION_RATIO_RX (-1)
#define MCE_DEFAULT_RING_LIMIT_PER_INTERFACE (0)
Expand Down Expand Up @@ -800,7 +800,7 @@ extern mce_sys_var &safe_mce_sys();
#define MCE_DEFAULT_CQ_AIM_INTERVAL_MSEC (1000)
#define MCE_DEFAULT_CQ_AIM_INTERRUPTS_RATE_PER_SEC (1000)
#define MCE_DEFAULT_CQ_POLL_BATCH (16)
#define MCE_DEFAULT_PROGRESS_ENGINE_INTERVAL_MSEC (10)
#define MCE_DEFAULT_PROGRESS_ENGINE_INTERVAL_MSEC (0)
#define MCE_DEFAULT_PROGRESS_ENGINE_WCE_MAX (10000)
#define MCE_DEFAULT_CQ_KEEP_QP_FULL (true)
#define MCE_DEFAULT_QP_COMPENSATION_LEVEL (256)
Expand Down

0 comments on commit 3480fb3

Please sign in to comment.