4e9adb3bf9
Use the macros for red black tree provided by Free BSD to manage timed pollers efficiently. Allow RB_INSERT() to insert elements with duplicated keys by changing the compare function to return 1 if two keys are equal. Check the return code of RB_INSERT() because this is the first use case for RB tree macros in SPDK. We did the same for RB_REMOVE() by adding another temporary variable but we remove it from this patch because it is not so important compared with RB_INSERT(). When a timed poller is inserted, update the cache for the closest (leftmost) timed poller only if the tree was empty before or the closest (leftmost) timed poller was actually changed. We do not have to use RB_MIN() because all duplicated entries are inserted on the right side. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ibe253ca8eecc10116548b5eedbcdba8fb961b88d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7722 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> |
||
---|---|---|
.. | ||
Makefile | ||
spdk_thread.map | ||
thread.c |