mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 08:24:30 +00:00
zebra: reduce atomic ops in fpm_nl_process()
Maintain the peak ctxqueue length in a local variable, and perform a single atomic update after processing all contexts. Generally this results in at least one less atomic operation per context. Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
This commit is contained in:
parent
dc693fe057
commit
bf2f783945
@ -1421,7 +1421,7 @@ static int fpm_nl_process(struct zebra_dplane_provider *prov)
|
||||
struct zebra_dplane_ctx *ctx;
|
||||
struct fpm_nl_ctx *fnc;
|
||||
int counter, limit;
|
||||
uint64_t cur_queue, peak_queue;
|
||||
uint64_t cur_queue, peak_queue = 0, stored_peak_queue;
|
||||
|
||||
fnc = dplane_provider_get_data(prov);
|
||||
limit = dplane_provider_get_work_limit(prov);
|
||||
@ -1449,13 +1449,8 @@ static int fpm_nl_process(struct zebra_dplane_provider *prov)
|
||||
cur_queue = atomic_load_explicit(
|
||||
&fnc->counters.ctxqueue_len,
|
||||
memory_order_relaxed);
|
||||
peak_queue = atomic_load_explicit(
|
||||
&fnc->counters.ctxqueue_len_peak,
|
||||
memory_order_relaxed);
|
||||
if (peak_queue < cur_queue)
|
||||
atomic_store_explicit(
|
||||
&fnc->counters.ctxqueue_len_peak,
|
||||
cur_queue, memory_order_relaxed);
|
||||
peak_queue = cur_queue;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1463,6 +1458,13 @@ static int fpm_nl_process(struct zebra_dplane_provider *prov)
|
||||
dplane_provider_enqueue_out_ctx(prov, ctx);
|
||||
}
|
||||
|
||||
/* Update peak queue length, if we just observed a new peak */
|
||||
stored_peak_queue = atomic_load_explicit(
|
||||
&fnc->counters.ctxqueue_len_peak, memory_order_relaxed);
|
||||
if (stored_peak_queue < peak_queue)
|
||||
atomic_store_explicit(&fnc->counters.ctxqueue_len_peak,
|
||||
peak_queue, memory_order_relaxed);
|
||||
|
||||
if (atomic_load_explicit(&fnc->counters.ctxqueue_len,
|
||||
memory_order_relaxed)
|
||||
> 0)
|
||||
|
Loading…
Reference in New Issue
Block a user