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
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 67dc7d6..3b2c7cd 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -819,6 +819,8 @@
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 b1dab32..9fc03a0 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -232,7 +232,8 @@
_ (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 14e4e21..c14cffa 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -127,7 +127,15 @@
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 8b722a0..e786b31 100644
--- a/src/vnet/session/segment_manager.h
+++ b/src/vnet/session/segment_manager.h
@@ -40,6 +40,7 @@
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_