diff options
author | Junfeng Wang <drenfong.wang@intel.com> | 2022-08-12 16:24:46 +0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2022-09-15 23:15:26 +0000 |
commit | c795b8836d83b4b062aa21423f842aa765269c2c (patch) | |
tree | 9c7f9835da485443b4a43477e706178661399bdd /src/vnet | |
parent | 0654242d1ef51566f0d58445a16053cf376e5a6e (diff) |
vcl: add hugepage for vcl configure and svm
add hugepage for vcl configure and svm
Type: feature
Signed-off-by: Junfeng Wang <drenfong.wang@intel.com>
Change-Id: I6a8905e3fec23d840e629114b1e5a403d0a258ef
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/session/application.c | 2 | ||||
-rw-r--r-- | src/vnet/session/application_interface.h | 3 | ||||
-rw-r--r-- | src/vnet/session/segment_manager.c | 10 | ||||
-rw-r--r-- | src/vnet/session/segment_manager.h | 1 |
4 files changed, 14 insertions, 2 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index 67dc7d633ec..3b2c7cdb35a 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -819,6 +819,8 @@ application_alloc_and_init (app_init_args_t * a) props->add_segment_size = opts[APP_OPTIONS_ADD_SEGMENT_SIZE]; props->add_segment = 1; } + if (opts[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_USE_HUGE_PAGE) + props->huge_page = 1; if (opts[APP_OPTIONS_RX_FIFO_SIZE]) props->rx_fifo_size = opts[APP_OPTIONS_RX_FIFO_SIZE]; if (opts[APP_OPTIONS_TX_FIFO_SIZE]) diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index b1dab322dd7..9fc03a0e97a 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -232,7 +232,8 @@ typedef enum _ (USE_GLOBAL_SCOPE, "App can use global session scope") \ _ (USE_LOCAL_SCOPE, "App can use local session scope") \ _ (EVT_MQ_USE_EVENTFD, "Use eventfds for signaling") \ - _ (MEMFD_FOR_BUILTIN, "Use memfd for builtin app segs") + _ (MEMFD_FOR_BUILTIN, "Use memfd for builtin app segs") \ + _ (USE_HUGE_PAGE, "Use huge page for FIFO") typedef enum _app_options { diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c index 14e4e219996..c14cffa66a2 100644 --- a/src/vnet/session/segment_manager.c +++ b/src/vnet/session/segment_manager.c @@ -127,7 +127,15 @@ segment_manager_add_segment_inline (segment_manager_t *sm, uword segment_size, sizeof (fifo_segment_header_t) + vlib_thread_main.n_vlib_mains * sizeof (fifo_segment_slice_t) + FIFO_SEGMENT_ALLOC_OVERHEAD; - segment_size = round_pow2 (segment_size, clib_mem_get_page_size ()); + + if (props->huge_page) + { + uword hugepage_size = clib_mem_get_default_hugepage_size (); + segment_size = round_pow2 (segment_size, hugepage_size); + fs->ssvm.huge_page = 1; + } + else + segment_size = round_pow2 (segment_size, clib_mem_get_page_size ()); seg_name = format (0, "seg-%u-%u-%u%c", app_wrk->app_index, app_wrk->wrk_index, smm->seg_name_counter++, 0); diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h index 8b722a02324..e786b3144c2 100644 --- a/src/vnet/session/segment_manager.h +++ b/src/vnet/session/segment_manager.h @@ -40,6 +40,7 @@ typedef struct _segment_manager_props u8 high_watermark; /**< memory usage high watermark % */ u8 low_watermark; /**< memory usage low watermark % */ u8 pct_first_alloc; /**< pct of fifo size to alloc */ + u8 huge_page; /**< use hugepage */ } segment_manager_props_t; typedef enum seg_manager_flag_ |