session svm: tracking segment memory usage
1. segment manager would attempt to balance the usages across
the segments, when it allocate fifos
2. the memory presure level is determined per fifo-segment
3. updated unit test
4. updated cli output for segments
Type: feature
Signed-off-by: Ryujiro Shibuya <ryujiro.shibuya@owmobility.com>
Change-Id: I2923f3e0a43dd919196a0cb2cd55e098fde6cf66
diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h
index 52f89ee..cad9550 100644
--- a/src/vnet/session/segment_manager.h
+++ b/src/vnet/session/segment_manager.h
@@ -34,6 +34,8 @@
u8 n_slices; /**< number of fs slices/threads */
ssvm_segment_type_t segment_type; /**< seg type: if set to SSVM_N_TYPES,
private segments are used */
+ u8 high_watermark; /**< memory usage high watermark % */
+ u8 low_watermark; /**< memory usage low watermark % */
} segment_manager_props_t;
typedef struct _segment_manager
@@ -58,6 +60,9 @@
* App event queue allocated in first segment
*/
svm_msg_q_t *event_queue;
+
+ u8 high_watermark;
+ u8 low_watermark;
} segment_manager_t;
typedef struct segment_manager_main_init_args_
@@ -69,8 +74,7 @@
#define SEGMENT_MANAGER_INVALID_APP_INDEX ((u32) ~0)
segment_manager_t *segment_manager_alloc (void);
-int segment_manager_init (segment_manager_t * sm, uword first_seg_size,
- u32 prealloc_fifo_pairs);
+int segment_manager_init (segment_manager_t * sm);
/**
* Cleanup segment manager
@@ -118,6 +122,9 @@
void segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo,
svm_fifo_t * tx_fifo);
+void segment_manager_set_watermarks (segment_manager_t * sm,
+ u8 high_watermark, u8 low_watermark);
+
u8 segment_manager_has_fifos (segment_manager_t * sm);
svm_msg_q_t *segment_manager_alloc_queue (fifo_segment_t * fs,