diff options
author | Damjan Marion <damarion@cisco.com> | 2018-10-24 17:08:26 +0200 |
---|---|---|
committer | Marco Varlese <marco.varlese@suse.de> | 2018-10-25 10:52:42 +0000 |
commit | 567e61d09cd00174203eff85f63a598420476951 (patch) | |
tree | 528e0fb979a25f990a552cbb3c4b14d491cff678 /src/vlib/buffer.c | |
parent | 3935fc8527c340535a00108b78f3de064df50a7f (diff) |
pmalloc: support for 4K pages
Change-Id: Iecceffe06a92660976ebb58cd3cbec4be8931db0
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/buffer.c')
-rw-r--r-- | src/vlib/buffer.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c index 22cf7999be7..ff91d3b920c 100644 --- a/src/vlib/buffer.c +++ b/src/vlib/buffer.c @@ -55,6 +55,9 @@ static u32 vlib_buffer_physmem_sz = 14 << 20; vlib_buffer_main_t buffer_main; +/* logging */ +static vlib_log_class_t buffer_log_default; + uword vlib_buffer_length_in_chain_slow_path (vlib_main_t * vm, vlib_buffer_t * b_first) @@ -963,6 +966,9 @@ vlib_buffer_main_init (struct vlib_main_t * vm) clib_error_t *error; u32 physmem_map_index; u8 pool_index; + int log2_page_size = 0; + + buffer_log_default = vlib_log_register_class ("buffer", 0); if (vlib_buffer_callbacks) { @@ -981,10 +987,24 @@ vlib_buffer_main_init (struct vlib_main_t * vm) &vlib_buffer_delete_free_list_internal; clib_spinlock_init (&bm->buffer_known_hash_lockp); - if ((error = vlib_physmem_shared_map_create (vm, "buffers", - vlib_buffer_physmem_sz, - CLIB_PMALLOC_NUMA_LOCAL, - &physmem_map_index))) +retry: + error = vlib_physmem_shared_map_create (vm, "buffers", + vlib_buffer_physmem_sz, + log2_page_size, + CLIB_PMALLOC_NUMA_LOCAL, + &physmem_map_index); + + if (error && log2_page_size == 0) + { + vlib_log_warn (buffer_log_default, "%U", format_clib_error, error); + clib_error_free (error); + vlib_log_warn (buffer_log_default, "falling back to non-hugepage " + "backed buffer pool"); + log2_page_size = min_log2 (clib_mem_get_page_size ()); + goto retry; + } + + if (error) return error; pool_index = vlib_buffer_register_physmem_map (vm, physmem_map_index); |