zebra: fix an issue: dplane failed to limit the maximum length of the… #16067
+20
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an issue where the "dplane" cannot effectively restrict the number of temporary caches for the contexts (ctx) under certain conditions. This issue occurs because when a ctx workqueue is processed and completed, the ctx is moved to another queue (rib_dplane_q), during which its memory is not immediately released. The memory for the ctx is only released after the rib_process_dplane_results function has completed processing. However, before this happens, the count in zdplane_info.dg_routes_queued is decreased, which leads the meta_queue_process function to mistakenly believe that enough space has been cleared, thus allowing more new ctxs to be created and enqueued. This results in the number of ctxs in the system not being limited as expected by the value set by dplane_get_in_queue_limit.
The fix attempts to adjust the timing of when zdplane_info.dg_routes_queued is decremented. The modification is made so that zdplane_info.dg_routes_queued is decreased only once rib_process_dplane_results has completely processed a ctx and the actual memory release process for it has begun. This way, it ensures that there is sufficient space for new ctxs to be enqueued.