aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/pool.h
diff options
context:
space:
mode:
authorStanislav Zaikin <zstaseg@gmail.com>2021-11-04 09:32:32 +0100
committerFlorin Coras <florin.coras@gmail.com>2021-11-25 22:45:58 +0000
commit09abed65b5c62cca5b850cc060e72192e3490811 (patch)
tree5ada564a2f0300a95ea7af528a62107bbf979197 /src/vppinfra/pool.h
parent4551715aaa647e5e565d81bd19fded8cacd8f778 (diff)
vppinfra: will_expand for pool_put and bitmap
Macro for pool_put and put a barrier inside load_balance_destroy when bitmap is actually growing. Type: improvement Signed-off-by: Stanislav Zaikin <zstaseg@gmail.com> Change-Id: Ief2912e8efd744289ebed68373fa6fd0ee83118e
Diffstat (limited to 'src/vppinfra/pool.h')
-rw-r--r--src/vppinfra/pool.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/vppinfra/pool.h b/src/vppinfra/pool.h
index 68a859edc8f..3b5a9007f4f 100644
--- a/src/vppinfra/pool.h
+++ b/src/vppinfra/pool.h
@@ -287,6 +287,25 @@ do { \
} \
} while (0)
+/** See if pool_put will expand free_bitmap or free_indices or not */
+#define pool_put_will_expand(P, E, YESNO) \
+ do \
+ { \
+ pool_header_t *_pool_var (p) = pool_header (P); \
+ \
+ uword _pool_var (i) = (E) - (P); \
+ /* free_bitmap or free_indices may expand. */ \
+ YESNO = \
+ clib_bitmap_will_expand (_pool_var (p)->free_bitmap, _pool_var (i)); \
+ \
+ YESNO += _vec_resize_will_expand ( \
+ _pool_var (p)->free_indices, 1, \
+ (vec_len (_pool_var (p)->free_indices) + 1) * \
+ sizeof (_pool_var (p)->free_indices[0]), \
+ 0, 0); \
+ } \
+ while (0)
+
/** Tell the caller if pool get will expand the pool */
#define pool_get_will_expand(P,YESNO) pool_get_aligned_will_expand(P,YESNO,0)