-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Optimize TLS on Windows #102655
Optimize TLS on Windows #102655
Conversation
r? @ChrisDenton (rust-highfive has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
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.
This approach seems reasonable to me. I just have a few tiny nits but nothing major.
@ChrisDenton Should I clean up the CI changes now? They obviously cannot be merged. |
Yes please. Could you also squish the commits? Speaking of, I notice you've moved some functions around ( |
6244ee9
to
d457801
Compare
Done 🎉 |
@bors r+ |
Optimize TLS on Windows This implements the suggestion in the current TLS code to embed the linked list of destructors in the `StaticKey` structure to save allocations. Additionally, locking is avoided when no destructor needs to be run. By using one Windows-provided `Once` per key instead of a global lock, locking is more finely-grained (this unblocks rust-lang#100579).
☀️ Test successful - checks-actions |
Finished benchmarking commit (fa0ca78): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Footnotes |
…sDenton Avoid dropping TLS Key on sgx rust-lang#102655 reenabled dropping thread local `Key` on every platform ([library/std/src/sys_common/thread_local_key.rs](rust-lang-ci@fa0ca78#diff-5cb9acf9e243f35c975fa9fbac4885519dc104626bc03610dfa7a20bc79641ceL237-R215)). That's causing problems at least for sgx. cc: `@jethrogb` `@ChrisDenton`
fix weak memory bug in TLS on Windows We need to store the `key` *after* we register the dtor. Now I hope there isn't also some other reason why we have to actually register the dtor last... `@joboet` is there a reason you picked this particular order in rust-lang#102655? Fixes rust-lang#123583
Rollup merge of rust-lang#124281 - RalfJung:win-tls, r=joboet fix weak memory bug in TLS on Windows We need to store the `key` *after* we register the dtor. Now I hope there isn't also some other reason why we have to actually register the dtor last... `@joboet` is there a reason you picked this particular order in rust-lang#102655? Fixes rust-lang#123583
fix weak memory bug in TLS on Windows We need to store the `key` *after* we register the dtor. Now I hope there isn't also some other reason why we have to actually register the dtor last... `@joboet` is there a reason you picked this particular order in rust-lang/rust#102655? Fixes rust-lang/rust#123583
This implements the suggestion in the current TLS code to embed the linked list of destructors in the
StaticKey
structure to save allocations. Additionally, locking is avoided when no destructor needs to be run. By using one Windows-providedOnce
per key instead of a global lock, locking is more finely-grained (this unblocks #100579).