Skip to content

Commit

Permalink
zebra: Temporarily block the execution of the rib_process function wh…
Browse files Browse the repository at this point in the history
…ile the thread t_dplane is waiting to be scheduled.

This allows t_dplane to prioritize freeing up the cache structures of zebra_dplane_ctx.
This addresses the issue where a large number of zebra_dplane_ctx nodes are cached on the rib_dplane_q when a surge of routes is inserted in a short period of time, leading to the consumption of a significant amount of temporary memory and potentially causing system memory overload and kernel OOM (Out of Memory) problems.

Signed-off-by: hanyu.zly <[email protected]>
  • Loading branch information
zice312963205 committed Dec 25, 2023
1 parent 080299f commit 3b8c4f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3228,7 +3228,7 @@ static wq_item_status meta_queue_process(struct work_queue *dummy, void *data)
/* Ensure there's room for more dataplane updates */
queue_limit = dplane_get_in_queue_limit();
queue_len = dplane_get_in_queue_len();
if (queue_len > queue_limit) {
if (queue_len > queue_limit || t_dplane) {
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug(
"rib queue: dplane queue len %u, limit %u, retrying",
Expand Down Expand Up @@ -4974,6 +4974,7 @@ static void rib_process_dplane_results(struct event *thread)
}

} while (1);
t_dplane = NULL;

#ifdef HAVE_SCRIPTING
if (fs)
Expand Down

0 comments on commit 3b8c4f1

Please sign in to comment.