cps: don't wait for routing daemons to make progress#484
Merged
AltraMayor merged 6 commits intomasterfrom Jun 4, 2021
Merged
Conversation
The code that supports routing daemons used to live in cps/kni.c. This patch moves this code to the new file cps/rd.c. This move splits cps/kni.c into two files about even in the number of lines. The file cps/kni.c had more tahn 2K linas before this patch.
Library CORO implements coroutines.
In order to list the routing table for routing daemons, the CPS block needs to acquire a spin lock. This patch yields the coroutine, so the CPS block goes and does something instead of busy wait for the lock.
The system call sendto() may block for quite a while when a routing daemon is busy. This patch tests if calling sendto() is going to block, if so, it yields to other activities.
Owner
Author
|
Tested in production. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The code of the CPS block that communicates with routing daemon via rtnetlink(7) may wait for routing daemons to receive large replies (e.g. dumping a large routing table) in order to make progress. This wait disrupts the CPS block, which not only is expected to serve the rtnetlink interface, but also the KNI interfaces, and internal messages via its mailbox.
This pull request moves the rtnetlink code in the CPS block into a coroutine. Thus, whenever a wait is needed, the coroutine yields the control to the other activities that the CPS block is responsible for.