FreeBSD: Create taskq threads in appropriate proc

Stepping stone toward re-enabling spa_thread on FreeBSD.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10715
This commit is contained in:
Ryan Moeller
2020-08-17 14:01:19 -04:00
committed by GitHub
parent fc34dfba8e
commit 3c3d7c8a57
4 changed files with 27 additions and 19 deletions
+8 -3
View File
@@ -61,13 +61,14 @@ typedef struct thread kthread_t;
typedef struct thread *kthread_id_t;
typedef struct proc proc_t;
extern struct proc *zfsproc;
extern proc_t *system_proc;
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, const char *name)
{
kthread_t *td = NULL;
proc_t **ppp;
int error;
/*
@@ -77,8 +78,12 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
ASSERT(len == 0);
ASSERT(state == TS_RUN);
error = kproc_kthread_add(proc, arg, &zfsproc, &td,
RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "%s", name);
if (pp == &p0)
ppp = &system_proc;
else
ppp = &pp;
error = kproc_kthread_add(proc, arg, ppp, &td, RFSTOPPED,
stksize / PAGE_SIZE, "zfskern", "%s", name);
if (error == 0) {
thread_lock(td);
sched_prio(td, pri);