mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
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 <behlendorf1@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Co-authored-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com> Closes #10630
This commit is contained in:
committed by
GitHub
parent
5678d3f593
commit
843e9ca2e1
@@ -65,7 +65,7 @@ extern struct proc *zfsproc;
|
||||
|
||||
static __inline kthread_t *
|
||||
do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
|
||||
size_t len, proc_t *pp, int state, pri_t pri)
|
||||
size_t len, proc_t *pp, int state, pri_t pri, const char *name)
|
||||
{
|
||||
kthread_t *td = NULL;
|
||||
int error;
|
||||
@@ -78,7 +78,7 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
|
||||
ASSERT(state == TS_RUN);
|
||||
|
||||
error = kproc_kthread_add(proc, arg, &zfsproc, &td,
|
||||
RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "solthread %p", proc);
|
||||
RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "%s", name);
|
||||
if (error == 0) {
|
||||
thread_lock(td);
|
||||
sched_prio(td, pri);
|
||||
@@ -90,8 +90,11 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
|
||||
return (td);
|
||||
}
|
||||
|
||||
#define thread_create_named(name, stk, stksize, proc, arg, len, \
|
||||
pp, state, pri) \
|
||||
do_thread_create(stk, stksize, proc, arg, len, pp, state, pri, name)
|
||||
#define thread_create(stk, stksize, proc, arg, len, pp, state, pri) \
|
||||
do_thread_create(stk, stksize, proc, arg, len, pp, state, pri)
|
||||
do_thread_create(stk, stksize, proc, arg, len, pp, state, pri, #proc)
|
||||
#define thread_exit() kthread_exit()
|
||||
|
||||
int uread(proc_t *, void *, size_t, uintptr_t);
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
|
||||
typedef void (*thread_func_t)(void *);
|
||||
|
||||
#define thread_create_named(name, stk, stksize, func, arg, len, \
|
||||
pp, state, pri) \
|
||||
__thread_create(stk, stksize, (thread_func_t)func, \
|
||||
name, arg, len, pp, state, pri)
|
||||
|
||||
/* BEGIN CSTYLED */
|
||||
#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
|
||||
__thread_create(stk, stksize, (thread_func_t)func, \
|
||||
|
||||
Reference in New Issue
Block a user