diff options
author | Dave Barach <dbarach@cisco.com> | 2017-08-02 13:56:13 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-08-10 14:34:31 +0000 |
commit | 818eb54de01459ed3d823f8a9781bbed0845db82 (patch) | |
tree | b3ec3cbfb20ae371a648e9c8f5a7aaaa027b457f /src/svm/svm_fifo_segment.h | |
parent | ef5dd4f2aec6df1b58aa8d07493acf486eccf802 (diff) |
Improve the svm fifo allocator
- Round up requested fifo size to the next power of two
- Maintain per-segment power-of-two freelists
- Allocate fifos in chunks, to amortize alignment overhead
- Detach builtin test client application after each run
so we can use different fifo sizes each time
- Be more suspicious of session / application indices
Useful prep work for dynamically resizing fifos. As far as the svm
fifo code is concerned, it's OK to set fifo->nitems anywhere in the
interval: [0, 1<<(fifo->freelist_index) + FIFO_SEGMENT_MIN_FIFO_SIZE]
It's unlikely that setting nitems below the path MTU will work out
very well...
Change-Id: Idad73a027dfb7412056cb02988b77e300fa7e8a7
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/svm/svm_fifo_segment.h')
-rw-r--r-- | src/svm/svm_fifo_segment.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/svm/svm_fifo_segment.h b/src/svm/svm_fifo_segment.h index a7a3f469bab..68bb4d3d57d 100644 --- a/src/svm/svm_fifo_segment.h +++ b/src/svm/svm_fifo_segment.h @@ -27,11 +27,15 @@ typedef enum FIFO_SEGMENT_N_FREELISTS } svm_fifo_segment_freelist_t; +#define FIFO_SEGMENT_MIN_FIFO_SIZE 2048 +#define FIFO_SEGMENT_MAX_FIFO_SIZE (8<<20) /* 8mb max fifo size */ +#define FIFO_SEGMENT_ALLOC_CHUNK_SIZE 32 /* allocation quantum */ + typedef struct { svm_fifo_t *fifos; /**< Linked list of active RX fifos */ u8 *segment_name; /**< Segment name */ - svm_fifo_t *free_fifos[FIFO_SEGMENT_N_FREELISTS]; /**< Free lists */ + svm_fifo_t **free_fifos; /**< Freelists, by fifo size */ } svm_fifo_segment_header_t; typedef struct |