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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time: lazy init TimerShared in TimerEntry #6512
time: lazy init TimerShared in TimerEntry #6512
Changes from 15 commits
bde0742
0eb1d3e
a4e1231
cb54a1e
f8874b2
9dd1e33
2d3efb6
1ae3de2
ef3630b
d4a95a3
f6fa09b
b1fa990
8c0c2e8
a9a11e9
ef657d2
a446e44
3a89c45
c47b739
8e40ec4
d328298
07953b5
373044d
0129c92
b492723
8af2a97
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this change the size of
Sleep
? CouldTimerEntry
be changed to reduce the change?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be possible. Your idea looks better, I'll give it a try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put
deadline
andhandle
inSleep
here for do not init theTimerEntry
, but I have to put them to a place to save them temporarily.Saving
handle
here is to ensure thetimeout
will panic if there is no runtime handle in TLS or we do notenable_time
orenable_all
.The size of
Sleep
is an issue worth considering. Is there any way to solve this problem?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you just don't call
clear_entry
in this method when it hasn't yet been registered?Based on @conradludgate's comment here, it sounds like this triggers a loom failure, but that's most likely due to some path where the timer is dropped concurrently with firing or something like that. If we've never been registered with the driver, then not calling
clear_entry
should be okay.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my test, it can improve the performance by reduicng lock contention when we always let timeout register into the driver. But, on the other hand, if the timeout never register into the driver, this can not bring significant performance improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That said, maybe we can use
inner: StdUnsafeCell<Option<TimerShared>>
for this purpose, the size ofSleep
should be barely changed.Avoiding
clear_entry
for unregisteredtimeout
s is not necessary. In this case, we should avoid constructing the intrusive linked list item.