diff options
author | Serapheim Dimitropoulos <[email protected]> | 2020-07-29 09:43:33 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-29 09:43:33 -0700 |
commit | 843e9ca2e1ef347cf6b0271ed84438afc145dfd4 (patch) | |
tree | 5aed2d7636105945e0ef2799bb066beb206be8a0 /include/sys | |
parent | 5678d3f59389a241c8d9c032513c38209bb53e70 (diff) |
Introduce names for ZTHRs
When debugging issues or generally analyzing the runtime of
a system it would be nice to be able to tell the different
ZTHRs running by name rather than having to analyze their
stack.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Co-authored-by: Ryan Moeller <[email protected]>
Signed-off-by: Serapheim Dimitropoulos <[email protected]>
Closes #10630
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/zfs_context.h | 3 | ||||
-rw-r--r-- | include/sys/zthr.h | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index ccae941b4..2abdb3e44 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -218,6 +218,9 @@ typedef pthread_t kthread_t; #define kpreempt(x) yield() #define getcomm() "unknown" +#define thread_create_named(name, stk, stksize, func, arg, len, \ + pp, state, pri) \ + zk_thread_create(func, arg, stksize, state) #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ zk_thread_create(func, arg, stksize, state) #define thread_exit() pthread_exit(NULL) diff --git a/include/sys/zthr.h b/include/sys/zthr.h index 0a05f5225..ae8c57e9e 100644 --- a/include/sys/zthr.h +++ b/include/sys/zthr.h @@ -24,10 +24,11 @@ typedef struct zthr zthr_t; typedef void (zthr_func_t)(void *, zthr_t *); typedef boolean_t (zthr_checkfunc_t)(void *, zthr_t *); -extern zthr_t *zthr_create(zthr_checkfunc_t checkfunc, - zthr_func_t *func, void *arg); -extern zthr_t *zthr_create_timer(zthr_checkfunc_t *checkfunc, - zthr_func_t *func, void *arg, hrtime_t nano_wait); +extern zthr_t *zthr_create(const char *zthr_name, + zthr_checkfunc_t checkfunc, zthr_func_t *func, void *arg); +extern zthr_t *zthr_create_timer(const char *zthr_name, + zthr_checkfunc_t *checkfunc, zthr_func_t *func, void *arg, + hrtime_t nano_wait); extern void zthr_destroy(zthr_t *t); extern void zthr_wakeup(zthr_t *t); |