diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c
index 4d1833e..459b1d1 100644
--- a/src/svm/svm_fifo_segment.c
+++ b/src/svm/svm_fifo_segment.c
@@ -56,69 +56,75 @@
     }
 }
 
-static void
-preallocate_fifo_pairs (svm_fifo_segment_private_t * s,
-			svm_fifo_segment_create_args_t * a, u32 protect_size)
+/**
+ * Pre-allocates fifo pairs in fifo segment
+ *
+ * The number of fifos pre-allocated is the minimum of the requested number
+ * of pairs and the maximum number that fit within the segment. If the maximum
+ * is hit, the number of fifo pairs requested is updated by subtracting the
+ * number of fifos that have been successfully allocated.
+ */
+void
+svm_fifo_segment_preallocate_fifo_pairs (svm_fifo_segment_private_t * s,
+					 u32 rx_fifo_size, u32 tx_fifo_size,
+					 u32 * n_fifo_pairs)
 {
-  svm_fifo_segment_header_t *fsh = s->h;
-  u32 rx_fifo_size, tx_fifo_size, pairs_to_allocate;
   u32 rx_rounded_data_size, tx_rounded_data_size, pair_size;
-  svm_fifo_t *f;
-  u8 *rx_fifo_space, *tx_fifo_space;
+  u32 rx_fifos_size, tx_fifos_size, pairs_to_allocate;
   int rx_freelist_index, tx_freelist_index;
+  ssvm_shared_header_t *sh = s->ssvm.sh;
+  svm_fifo_segment_header_t *fsh = s->h;
+  u8 *rx_fifo_space, *tx_fifo_space;
+  uword space_available;
+  void *oldheap;
+  svm_fifo_t *f;
   int i;
 
   /* Parameter check */
-  if (a->rx_fifo_size == 0 || a->tx_fifo_size == 0
-      || a->preallocated_fifo_pairs == 0)
+  if (rx_fifo_size == 0 || tx_fifo_size == 0 || *n_fifo_pairs == 0)
     return;
 
-  if (a->rx_fifo_size < FIFO_SEGMENT_MIN_FIFO_SIZE ||
-      a->rx_fifo_size > FIFO_SEGMENT_MAX_FIFO_SIZE)
+  if (rx_fifo_size < FIFO_SEGMENT_MIN_FIFO_SIZE ||
+      rx_fifo_size > FIFO_SEGMENT_MAX_FIFO_SIZE)
     {
-      clib_warning ("rx fifo_size out of range %d", a->rx_fifo_size);
+      clib_warning ("rx fifo_size out of range %d", rx_fifo_size);
       return;
     }
 
-  if (a->tx_fifo_size < FIFO_SEGMENT_MIN_FIFO_SIZE ||
-      a->tx_fifo_size > FIFO_SEGMENT_MAX_FIFO_SIZE)
+  if (tx_fifo_size < FIFO_SEGMENT_MIN_FIFO_SIZE ||
+      tx_fifo_size > FIFO_SEGMENT_MAX_FIFO_SIZE)
     {
-      clib_warning ("tx fifo_size out of range %d", a->rx_fifo_size);
+      clib_warning ("tx fifo_size out of range %d", rx_fifo_size);
       return;
     }
 
-  rx_rounded_data_size = (1 << (max_log2 (a->rx_fifo_size)));
-
-  rx_freelist_index = max_log2 (a->rx_fifo_size)
+  rx_rounded_data_size = (1 << (max_log2 (rx_fifo_size)));
+  rx_freelist_index = max_log2 (rx_fifo_size)
     - max_log2 (FIFO_SEGMENT_MIN_FIFO_SIZE);
-
-  tx_rounded_data_size = (1 << (max_log2 (a->rx_fifo_size)));
-
-  tx_freelist_index = max_log2 (a->tx_fifo_size)
+  tx_rounded_data_size = (1 << (max_log2 (tx_fifo_size)));
+  tx_freelist_index = max_log2 (tx_fifo_size)
     - max_log2 (FIFO_SEGMENT_MIN_FIFO_SIZE);
 
   /* Calculate space requirements */
   pair_size = 2 * sizeof (*f) + rx_rounded_data_size + tx_rounded_data_size;
-  if (protect_size)
-    protect_size += mheap_bytes (s->ssvm.sh->heap);
-  pairs_to_allocate =
-    clib_min ((s->ssvm.ssvm_size - protect_size) / pair_size,
-	      a->preallocated_fifo_pairs);
-  rx_fifo_size = (sizeof (*f) + rx_rounded_data_size) * pairs_to_allocate;
-  tx_fifo_size = (sizeof (*f) + tx_rounded_data_size) * pairs_to_allocate;
+  space_available = s->ssvm.ssvm_size - mheap_bytes (sh->heap);
+  pairs_to_allocate = clib_min (space_available / pair_size, *n_fifo_pairs);
+  rx_fifos_size = (sizeof (*f) + rx_rounded_data_size) * pairs_to_allocate;
+  tx_fifos_size = (sizeof (*f) + tx_rounded_data_size) * pairs_to_allocate;
 
   vec_validate_init_empty (fsh->free_fifos,
 			   clib_max (rx_freelist_index, tx_freelist_index),
 			   0);
 
+  oldheap = ssvm_push_heap (sh);
   /* Allocate rx fifo space. May fail. */
   rx_fifo_space = clib_mem_alloc_aligned_at_offset
-    (rx_fifo_size, CLIB_CACHE_LINE_BYTES, 0 /* align_offset */ ,
+    (rx_fifos_size, CLIB_CACHE_LINE_BYTES, 0 /* align_offset */ ,
      0 /* os_out_of_memory */ );
 
   /* Same for TX */
   tx_fifo_space = clib_mem_alloc_aligned_at_offset
-    (tx_fifo_size, CLIB_CACHE_LINE_BYTES, 0 /* align_offset */ ,
+    (tx_fifos_size, CLIB_CACHE_LINE_BYTES, 0 /* align_offset */ ,
      0 /* os_out_of_memory */ );
 
   /* Make sure it worked. Clean up if it didn't... */
@@ -128,13 +134,14 @@
 	clib_mem_free (rx_fifo_space);
       else
 	clib_warning ("rx fifo preallocation failure: size %d npairs %d",
-		      a->rx_fifo_size, a->preallocated_fifo_pairs);
+		      rx_fifo_size, *n_fifo_pairs);
 
       if (tx_fifo_space)
 	clib_mem_free (tx_fifo_space);
       else
 	clib_warning ("tx fifo preallocation failure: size %d nfifos %d",
-		      a->tx_fifo_size, a->preallocated_fifo_pairs);
+		      tx_fifo_size, *n_fifo_pairs);
+      ssvm_pop_heap (oldheap);
       return;
     }
 
@@ -160,7 +167,31 @@
     }
 
   /* Account for the pairs allocated */
-  a->preallocated_fifo_pairs -= pairs_to_allocate;
+  *n_fifo_pairs -= pairs_to_allocate;
+  ssvm_pop_heap (oldheap);
+}
+
+/**
+ * Initialize svm fifo segment shared header
+ */
+int
+svm_fifo_segment_init (svm_fifo_segment_private_t * s)
+{
+  svm_fifo_segment_header_t *fsh;
+  ssvm_shared_header_t *sh;
+  void *oldheap;
+
+  sh = s->ssvm.sh;
+  oldheap = ssvm_push_heap (sh);
+
+  fsh = clib_mem_alloc (sizeof (*fsh));
+  memset (fsh, 0, sizeof (*fsh));
+  s->h = sh->opaque[0] = fsh;
+
+  ssvm_pop_heap (oldheap);
+
+  sh->ready = 1;
+  return (0);
 }
 
 /**
@@ -171,9 +202,6 @@
 {
   svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
   svm_fifo_segment_private_t *s;
-  ssvm_shared_header_t *sh;
-  svm_fifo_segment_header_t *fsh;
-  void *oldheap;
   int rv;
 
   /* Allocate a fresh segment */
@@ -195,18 +223,7 @@
   /* Note: requested_va updated due to seg base addr randomization */
   sm->next_baseva = s->ssvm.sh->ssvm_va + a->segment_size;
 
-  sh = s->ssvm.sh;
-  oldheap = ssvm_push_heap (sh);
-
-  /* Set up svm_fifo_segment shared header */
-  fsh = clib_mem_alloc (sizeof (*fsh));
-  memset (fsh, 0, sizeof (*fsh));
-  s->h = sh->opaque[0] = fsh;
-  preallocate_fifo_pairs (s, a, a->seg_protected_space);
-
-  ssvm_pop_heap (oldheap);
-
-  sh->ready = 1;
+  svm_fifo_segment_init (s);
   vec_add1 (a->new_segment_indices, s - sm->segments);
   return (0);
 }
@@ -217,78 +234,45 @@
 int
 svm_fifo_segment_create_process_private (svm_fifo_segment_create_args_t * a)
 {
-  svm_fifo_segment_private_t *s;
   svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
+  svm_fifo_segment_private_t *s;
   ssvm_shared_header_t *sh;
-  svm_fifo_segment_header_t *fsh;
-  void *oldheap;
-  u8 **heaps = 0;
   mheap_t *heap_header;
-  int segment_count = 1;
   u32 rnd_size = 0;
-  int i;
+  u8 *heap;
+  u32 pagesize = clib_mem_get_page_size ();
 
-  if (a->private_segment_count)
+  pool_get (sm->segments, s);
+  memset (s, 0, sizeof (*s));
+
+  rnd_size = (a->segment_size + (pagesize - 1)) & ~pagesize;
+
+  heap = mheap_alloc (0, rnd_size);
+  if (heap == 0)
     {
-      u8 *heap;
-      u32 pagesize = clib_mem_get_page_size ();
-      rnd_size = (a->segment_size + (pagesize - 1)) & ~pagesize;
-
-      for (i = 0; i < a->private_segment_count; i++)
-	{
-	  heap = mheap_alloc (0, rnd_size);
-	  if (heap == 0)
-	    {
-	      clib_unix_warning ("mheap alloc");
-	      return -1;
-	    }
-	  heap_header = mheap_header (heap);
-	  heap_header->flags |= MHEAP_FLAG_THREAD_SAFE;
-	  vec_add1 (heaps, heap);
-	}
-      segment_count = a->private_segment_count;
+      clib_unix_warning ("mheap alloc");
+      pool_put (sm->segments, s);
+      return -1;
     }
+  heap_header = mheap_header (heap);
+  heap_header->flags |= MHEAP_FLAG_THREAD_SAFE;
 
-  /* Allocate segments */
-  for (i = 0; i < segment_count; i++)
-    {
-      pool_get (sm->segments, s);
-      memset (s, 0, sizeof (*s));
+  s->ssvm.ssvm_size = rnd_size;
+  s->ssvm.i_am_master = 1;
+  s->ssvm.my_pid = getpid ();
+  s->ssvm.name = format (0, "%s%c", a->segment_name, 0);
+  s->ssvm.requested_va = ~0;
 
-      s->ssvm.ssvm_size = rnd_size;
-      s->ssvm.i_am_master = 1;
-      s->ssvm.my_pid = getpid ();
-      s->ssvm.name = format (0, "%s%c", a->segment_name, 0);
-      s->ssvm.requested_va = ~0;
+  /* Allocate a [sic] shared memory header, in process memory... */
+  sh = clib_mem_alloc_aligned (sizeof (*sh), CLIB_CACHE_LINE_BYTES);
+  s->ssvm.sh = sh;
 
-      /* Allocate a [sic] shared memory header, in process memory... */
-      sh = clib_mem_alloc_aligned (sizeof (*sh), CLIB_CACHE_LINE_BYTES);
-      s->ssvm.sh = sh;
+  memset (sh, 0, sizeof (*sh));
+  sh->heap = heap;
 
-      memset (sh, 0, sizeof (*sh));
-      sh->heap = a->private_segment_count ? heaps[i] : clib_mem_get_heap ();
+  svm_fifo_segment_init (s);
+  vec_add1 (a->new_segment_indices, s - sm->segments);
 
-      /* Set up svm_fifo_segment shared header */
-      fsh = clib_mem_alloc (sizeof (*fsh));
-      memset (fsh, 0, sizeof (*fsh));
-      fsh->flags = FIFO_SEGMENT_F_IS_PRIVATE;
-      s->h = sh->opaque[0] = fsh;
-      if (!a->private_segment_count)
-	fsh->flags |= FIFO_SEGMENT_F_IS_MAIN_HEAP;
-
-      if (a->private_segment_count)
-	{
-	  if (i != 0)
-	    fsh->flags |= FIFO_SEGMENT_F_IS_PREALLOCATED;
-	  oldheap = clib_mem_get_heap ();
-	  clib_mem_set_heap (sh->heap);
-	  preallocate_fifo_pairs (s, a, i == 0 ? a->seg_protected_space : 0);
-	  clib_mem_set_heap (oldheap);
-	}
-      sh->ready = 1;
-      vec_add1 (a->new_segment_indices, s - sm->segments);
-    }
-  vec_free (heaps);
   return (0);
 }
 
@@ -333,18 +317,7 @@
 {
   svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
 
-  if (s->h->flags & FIFO_SEGMENT_F_IS_PRIVATE)
-    {
-      /* Don't try to free vpp's heap! */
-      if (!(s->h->flags & FIFO_SEGMENT_F_IS_MAIN_HEAP))
-	mheap_free (s->ssvm.sh->heap);
-      clib_mem_free (s->ssvm.sh);
-      clib_mem_free (s->h);
-    }
-  else
-    {
-      ssvm_delete (&s->ssvm);
-    }
+  ssvm_delete (&s->ssvm);
   memset (s, 0xfe, sizeof (*s));
   pool_put (sm->segments, s);
 }
@@ -378,10 +351,10 @@
     - max_log2 (FIFO_SEGMENT_MIN_FIFO_SIZE);
 
   sh = s->ssvm.sh;
-  fsh = (svm_fifo_segment_header_t *) sh->opaque[0];
 
   ssvm_lock_non_recursive (sh, 1);
   oldheap = ssvm_push_heap (sh);
+  fsh = (svm_fifo_segment_header_t *) sh->opaque[0];
 
   switch (list_index)
     {
@@ -508,7 +481,7 @@
 }
 
 void
-svm_fifo_segment_init (u64 baseva, u32 timeout_in_seconds)
+svm_fifo_segment_main_init (u64 baseva, u32 timeout_in_seconds)
 {
   svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
 
@@ -595,7 +568,7 @@
 svm_fifo_segment_info (svm_fifo_segment_private_t * seg, uword * address,
 		       u64 * size)
 {
-  if (seg->h->flags & FIFO_SEGMENT_F_IS_PRIVATE)
+  if (ssvm_type (&seg->ssvm) == SSVM_SEGMENT_PRIVATE)
     {
       mheap_t *heap_header;
 
@@ -623,12 +596,8 @@
   sp = va_arg (*args, svm_fifo_segment_private_t *);
   ssvm_segment_type_t st = ssvm_type (&sp->ssvm);
 
-  if ((sp->h->flags & FIFO_SEGMENT_F_IS_PRIVATE)
-      && !(sp->h->flags & FIFO_SEGMENT_F_IS_MAIN_HEAP))
+  if (st == SSVM_SEGMENT_PRIVATE)
     s = format (s, "%s", "private-heap");
-  else if ((sp->h->flags & FIFO_SEGMENT_F_IS_PRIVATE)
-	   && (sp->h->flags & FIFO_SEGMENT_F_IS_MAIN_HEAP))
-    s = format (s, "%s", "main-heap");
   else if (st == SSVM_SEGMENT_MEMFD)
     s = format (s, "%s", "memfd");
   else if (st == SSVM_SEGMENT_SHM)
