Support custom ParkingLot number#3033
Merged
wwbmmm merged 3 commits intoapache:masterfrom Aug 18, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for configurable parking lot numbers per tag in the bthread system, replacing the hardcoded PARKING_LOT_NUM constant with a runtime configurable value. The changes enable users to customize the number of parking lots per tag through a new flag.
- Removes hardcoded
PARKING_LOT_NUM = 4constant and replaces it with configurable_pl_num_of_each_tag - Adds new command-line flag
bthread_parking_lot_of_each_tagto control parking lot count - Updates parking lot iteration logic to use the configurable value instead of hardcoded constant
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/bthread/task_control.h | Removes hardcoded PARKING_LOT_NUM constant, renames member variable to _tagged_pl, and adds _pl_num_of_each_tag field |
| src/bthread/task_control.cpp | Implements configurable parking lot logic using new flag and updates iteration patterns |
| src/bthread/bthread.cpp | Defines new bthread_parking_lot_of_each_tag flag and contains unrelated namespace cleanup |
b35b1ed to
53f7218
Compare
wwbmmm
reviewed
Jul 20, 2025
Contributor
|
LGTM |
Contributor
|
一般parkinglot的数量和worker的数量,怎么样是比较合适的。 |
Contributor
|
LGTM |
Contributor
Author
可以调整为平均4/8个worker线程共享一个ParkingLot,在实际场景测试一下效果才能确定个数。 我们的场景是worker线程数多(200+)、大量轻量bthread,火焰图显示在ParkingLot futex内核自旋锁的操作消耗了过多的CPU。 |
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.
What problem does this PR solve?
Issue Number: #2849 (comment)
Problem Summary:
What is changed and the side effects?
Changed:
Side effects:
Performance effects:
Breaking backward compatibility:
Check List: