summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/segment_manager.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-07-12 01:45:13 -0700
committerDamjan Marion <dmarion@me.com>2018-07-17 09:01:46 +0000
commit5da96a77a84ae5414debbc46d390464d51010113 (patch)
tree5895f437c915ea7a5db7288afa2f2c68820ed0b8 /src/vnet/session/segment_manager.c
parent208c29aac523231af2420a95ba7e5d361698780b (diff)
session: make sure segment sizes are page aligned
Change-Id: Ibbba75d069ca1bbf9e5a1b8bd2f405d32021c656 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/segment_manager.c')
-rw-r--r--src/vnet/session/segment_manager.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 9dade6ec0d6..31bb0c3aab5 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -153,7 +153,7 @@ int
segment_manager_add_segment (segment_manager_t * sm, u32 segment_size)
{
segment_manager_main_t *smm = &segment_manager_main;
- u32 rnd_margin = 128 << 10, seg_index;
+ u32 rnd_margin = 128 << 10, seg_index, page_size;
segment_manager_properties_t *props;
uword baseva = (u64) ~ 0, alloc_size;
svm_fifo_segment_private_t *seg;
@@ -187,6 +187,8 @@ segment_manager_add_segment (segment_manager_t * sm, u32 segment_size)
* Initialize ssvm segment and svm fifo private header
*/
segment_size = segment_size ? segment_size : props->add_segment_size;
+ page_size = clib_mem_get_page_size ();
+ segment_size = (segment_size + page_size - 1) & ~(page_size - 1);
if (props->segment_type != SSVM_SEGMENT_PRIVATE)
{
seg_name = format (0, "%d-%d%c", getpid (), segment_name_counter++, 0);