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 28, 2023
1 parent 080299f commit f214941
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3228,11 +3228,17 @@ 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 (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug(
"rib queue: dplane queue len %u, limit %u, retrying",
queue_len, queue_limit);
if (queue_len > queue_limit || t_dplane) {
if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
if (t_dplane)
zlog_debug(
"rib_process_dplane_results is running, retrying",
queue_len, queue_limit);
else
zlog_debug(
"rib queue: dplane queue len %u, limit %u, retrying",
queue_len, queue_limit);
}

/* Ensure that the meta-queue is actually enqueued */
if (work_queue_empty(zrouter.ribq))
Expand Down Expand Up @@ -4974,6 +4980,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 f214941

Please sign in to comment.