Skip to content
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

use BAIDU_VOLATILE_THREAD_LOCAL to declare tls_bls to avoid error compiler optimization #2934

Merged
merged 8 commits into from
Apr 8, 2025

Conversation

BiteTheDDDDt
Copy link
Contributor

What problem does this PR solve?
解决bthread_setspecific注册的变量,用bthread_getspecific可能会找不到的问题。
Problem Summary:
根据 #1776 , #2156 里的一些相关描述,我尝试将清理tls这段代码抽出来作为单独函数并声明为noinline,在我自己的场景下测试可以修复这个问题

Changed:

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@wwbmmm
Copy link
Contributor

wwbmmm commented Apr 2, 2025

是否可以在访问tls_bls变量时使用 BAIDU_GET_VOLATILE_THREAD_LOCAL宏?这种方法应该更通用一些

@chenBright
Copy link
Contributor

是否可以在访问tls_bls变量时使用 BAIDU_GET_VOLATILE_THREAD_LOCAL宏?这种方法应该更通用一些

+1

@chenBright
Copy link
Contributor

master已经修复了ci中cmake的问题,麻烦rebase一下。@BiteTheDDDDt

@BiteTheDDDDt BiteTheDDDDt changed the title move clean_tls_bls to single noinline function to avoid compiler optimization use BAIDU_VOLATILE_THREAD_LOCAL to declare tls_bls to avoid error compiler optimization Apr 4, 2025
Copy link
Contributor

@chenBright chenBright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chenBright chenBright merged commit 65b550e into apache:master Apr 8, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants