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
This commit is contained in:

committed by
Florin Coras

parent
0654242d1e
commit
c795b8836d
@ -227,8 +227,12 @@ ssvm_server_init_memfd (ssvm_private_t * memfd)
|
||||
|
||||
ASSERT (vec_c_string_is_terminated (memfd->name));
|
||||
|
||||
memfd->fd = clib_mem_vm_create_fd (CLIB_MEM_PAGE_SZ_DEFAULT,
|
||||
(char *) memfd->name);
|
||||
if (memfd->huge_page)
|
||||
memfd->fd = clib_mem_vm_create_fd (CLIB_MEM_PAGE_SZ_DEFAULT_HUGE,
|
||||
(char *) memfd->name);
|
||||
else
|
||||
memfd->fd =
|
||||
clib_mem_vm_create_fd (CLIB_MEM_PAGE_SZ_DEFAULT, (char *) memfd->name);
|
||||
|
||||
if (memfd->fd == CLIB_MEM_ERROR)
|
||||
{
|
||||
@ -270,7 +274,7 @@ ssvm_server_init_memfd (ssvm_private_t * memfd)
|
||||
sh->ssvm_va = pointer_to_uword (sh);
|
||||
sh->type = SSVM_SEGMENT_MEMFD;
|
||||
|
||||
page_size = 1ULL << log2_page_size;
|
||||
page_size = clib_mem_get_page_size ();
|
||||
sh->heap = clib_mem_create_heap (((u8 *) sh) + page_size,
|
||||
memfd->ssvm_size - page_size,
|
||||
1 /* locked */ , "ssvm server memfd");
|
||||
|
@ -87,7 +87,7 @@ typedef struct
|
||||
u8 *name;
|
||||
u8 numa; /**< UNUSED: numa requested at alloc time */
|
||||
int is_server;
|
||||
|
||||
int huge_page;
|
||||
union
|
||||
{
|
||||
int fd; /**< memfd segments */
|
||||
|
@ -354,7 +354,8 @@ vcl_bapi_send_attach (void)
|
||||
(vcm->cfg.app_scope_local ? APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE : 0) |
|
||||
(vcm->cfg.app_scope_global ? APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE : 0) |
|
||||
(app_is_proxy ? APP_OPTIONS_FLAGS_IS_PROXY : 0) |
|
||||
(vcm->cfg.use_mq_eventfd ? APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD : 0);
|
||||
(vcm->cfg.use_mq_eventfd ? APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD : 0) |
|
||||
(vcm->cfg.huge_page ? APP_OPTIONS_FLAGS_USE_HUGE_PAGE : 0);
|
||||
bmp->options[APP_OPTIONS_PROXY_TRANSPORT] =
|
||||
(u64) ((vcm->cfg.app_proxy_transport_tcp ? 1 << TRANSPORT_PROTO_TCP : 0) |
|
||||
(vcm->cfg.app_proxy_transport_udp ? 1 << TRANSPORT_PROTO_UDP : 0));
|
||||
|
@ -416,6 +416,12 @@ vppcom_cfg_read_file (char *conf_fname)
|
||||
VCFG_DBG (0, "VCL<%d>: configured app_scope_global (%d)",
|
||||
getpid (), vcl_cfg->app_scope_global);
|
||||
}
|
||||
else if (unformat (line_input, "huge_page"))
|
||||
{
|
||||
vcl_cfg->huge_page = 1;
|
||||
VCFG_DBG (0, "VCL<%d>: configured huge_page (%d)", getpid (),
|
||||
vcl_cfg->huge_page);
|
||||
}
|
||||
else if (unformat (line_input, "namespace-secret %lu",
|
||||
&vcl_cfg->namespace_secret))
|
||||
{
|
||||
|
@ -204,6 +204,7 @@ typedef struct vppcom_cfg_t_
|
||||
u8 *vpp_bapi_socket_name; /**< bapi socket transport socket name */
|
||||
u32 tls_engine;
|
||||
u8 mt_wrk_supported;
|
||||
u8 huge_page;
|
||||
} vppcom_cfg_t;
|
||||
|
||||
void vppcom_cfg (vppcom_cfg_t * vcl_cfg);
|
||||
|
@ -127,7 +127,8 @@ vcl_api_send_attach (clib_socket_t * cs)
|
||||
(vcm->cfg.app_scope_local ? APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE : 0) |
|
||||
(vcm->cfg.app_scope_global ? APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE : 0) |
|
||||
(app_is_proxy ? APP_OPTIONS_FLAGS_IS_PROXY : 0) |
|
||||
(vcm->cfg.use_mq_eventfd ? APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD : 0);
|
||||
(vcm->cfg.use_mq_eventfd ? APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD : 0) |
|
||||
(vcm->cfg.huge_page ? APP_OPTIONS_FLAGS_USE_HUGE_PAGE : 0);
|
||||
mp->options[APP_OPTIONS_PROXY_TRANSPORT] =
|
||||
(u64) ((vcm->cfg.app_proxy_transport_tcp ? 1 << TRANSPORT_PROTO_TCP : 0) |
|
||||
(vcm->cfg.app_proxy_transport_udp ? 1 << TRANSPORT_PROTO_UDP : 0));
|
||||
|
@ -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])
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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_
|
||||
|
Reference in New Issue
Block a user