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
common: add thread names #5882
common: add thread names #5882
Conversation
👍 a good tools |
Note that there is a limit of 15 or 16 characters for this name. I believe set_name will return an error if it's exceeded. I tried to do a patch that populated thread names with, e.g., workqueue names, but they were too long :( I think it should assert if the length is too long so we catch those bugs immediately instead of it silently failing... |
Yep you're right, missed in manual. I'll fix this on Monday. EDIT_1: fixed According to manual pthread_setname_np() can fail with error like open(2) at /proc/self/task/[tid]/comm, but I don't check this. If it fails, you will see duplicated process name in thread list. EDIT_2: added missing name + squashed |
34eb63c
to
e8e3ebf
Compare
e8e3ebf
to
e486653
Compare
Another bonus using thread names can be seen in core dumps:
Now I see, that maybe i should concatenate names with '_' instead of spaces. |
@aiicore , How are you getting on with this PR? I think this is every useful for debugging performance. |
e486653
to
b2ec464
Compare
@XinzeChi, Done. |
|
||
submit_thread.create(); | ||
submit_thread.create("md_sumbit"); |
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.
md_submit
some cosmetic nits, but otherwise this looks great! |
1b2beeb
to
c504052
Compare
f2820a6
to
eb35d4f
Compare
eb35d4f
to
faef32c
Compare
faef32c
to
092e960
Compare
092e960
to
52b8de4
Compare
52b8de4
to
b79ed03
Compare
&osd->recovery_tp), | ||
op_gen_wq("op_gen_wq", cct->_conf->osd_recovery_thread_timeout, &osd->osd_tp), | ||
op_gen_wq("op_gen_wq", "wq_gen_op", cct->_conf->osd_recovery_thread_timeout, &osd->osd_tp), |
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.
Sometimes It looks funny, but I wanted to keep thread naming convention.
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.
Which convention? Matching the other name seems convenient..
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.
Thread name looks just like a mirror of wq name ;)
@Sage could you have a look in the meantime on my comments and general wq_/fn_ naming like you did before with ms_? |
fn_ and tp_ prefixes seem okay to me. (not wq_, since the thread belongs to the thread pool, and we don't want to change the thread name for every work item). |
b79ed03
to
ffa770c
Compare
@aiicore can you rebase please? |
ffa770c
to
d3ca232
Compare
Adding names to threads simplifies cpu usage realtime tracking e.g. top -H -p <OSD_PID> This commit changes Thread.create() method forcing to pass thread name. Signed-off-by: Igor Podoski <igor.podoski@ts.fujitsu.com>
d3ca232
to
4a4b447
Compare
common: add thread names Reviewed-by: Sage Weil <sage@redhat.com>
The only visible effect of this change is that the constructor no longer takes a name for the finisher thread. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
Adding names to threads simplifies cpu usage realtime tracking e.g. top -H -p <OSD_PID>
This commit changes Thread.create() method forcing to pass thread name.
Example:
Signed-off-by: Igor Podoski igor.podoski@ts.fujitsu.com