Conversation
|
@skyegalaxy @jmachowinski wdyt? |
ABI Compliance Check❌ Verdict: incompatible
✅
|
|
I got #3277 in flight and would like to merge it first. I highly expect merge conflicts from it. |
|
Alright I would revisit this after that’s merged. |
Signed-off-by: Arman Hosseini <armanhosseini878787@gmail.com>
8d908eb to
cd26180
Compare
|
Now that #3277 is merged, we can say that there's no merge conflict. I also double checked the code and tests. Everything seems to hold up. This is ready to review. |
|
Even though this reduces the number of code lines, I think it makes the code harder to understand. I also fear that we are introducing lock order inversions. Did you check the code with something like helgrind (part of valgrind) or -fsanitize=thread ? Note, that at some point there was a version that had a simpler logic, but that we needed shift code around to solve these locking issues. |
|
I came up with this idea when I was trying to write a custom scheduler. It was hard for me to account for all 16 different combinations of The only reason that it's a counter rather than a flag is that a reentrant callback group can have multiple entities in the scheduler at the same time and it's hard to keep a flag up to date when we remove a ready entity (we have to search the whole queue to find out whether we have another ready entity of the same group). And about the locking order, by reading the code I think that we always take |
|
Maybe we can replace the whole thing with a |
Description
Resolves #3289 by replacing the three flags inside
CBGScheduler::CallbackGroupHandle(not_ready,idleandin_queue) with a simplein_scheduler_countfield. This field keeps track of the number of entities that are currently in scheduler, either executing or just ready. The changes also make managing reentrant callback groups easier.This PR also makes #3288 unnecessary since we don't handle reentrant callback groups in
FIFOScheduler::get_next_ready_entity_internmethods anymore.Is this user-facing behavior change?
No.
Did you use Generative AI?
No.
Additional Information
Aside from other test cases, I manually tested the changes to see its behavior regarding different types of CBGs. My test case is here (I'm using yaets for tracing):
Here's the grant chart for the case of mutually exclusive subscribers:
And for reentrant ones: