summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/segment_manager.h
diff options
context:
space:
mode:
authorRyujiro Shibuya <ryujiro.shibuya@owmobility.com>2019-12-25 07:40:54 +0000
committerDave Barach <openvpp@barachs.net>2020-02-25 19:18:49 +0000
commit234fe894d80a6ebc7e457bc86f2eea80d5ef01ea (patch)
tree89d1e728091669f4199f668b2438b26ab3f95d9b /src/vnet/session/segment_manager.h
parentf22f4e562e1b922cff036ef628b77fd2d479d015 (diff)
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
Diffstat (limited to 'src/vnet/session/segment_manager.h')
-rw-r--r--src/vnet/session/segment_manager.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h
index 52f89eef171..cad95509b2e 100644
--- a/src/vnet/session/segment_manager.h
+++ b/src/vnet/session/segment_manager.h
@@ -34,6 +34,8 @@ typedef struct _segment_manager_props
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 @@ typedef struct _segment_manager
* 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 @@ typedef struct segment_manager_main_init_args_
#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 @@ int segment_manager_try_alloc_fifos (fifo_segment_t * fs,
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,