provide a way to assign taskqueue threads to a kernel process
This can be used to group all threads belonging to a single logical entity under a common kernel process. I am planning to use the new interface for ZFS threads. MFC after: 4 weeks
This commit is contained in:
parent
fc0b98158d
commit
5fdc2c044e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353678
@ -654,7 +654,7 @@ taskqueue_swi_giant_run(void *dummy)
|
||||
|
||||
static int
|
||||
_taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
|
||||
cpuset_t *mask, const char *name, va_list ap)
|
||||
cpuset_t *mask, struct proc *p, const char *name, va_list ap)
|
||||
{
|
||||
char ktname[MAXCOMLEN + 1];
|
||||
struct thread *td;
|
||||
@ -676,10 +676,10 @@ _taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (count == 1)
|
||||
error = kthread_add(taskqueue_thread_loop, tqp, NULL,
|
||||
error = kthread_add(taskqueue_thread_loop, tqp, p,
|
||||
&tq->tq_threads[i], RFSTOPPED, 0, "%s", ktname);
|
||||
else
|
||||
error = kthread_add(taskqueue_thread_loop, tqp, NULL,
|
||||
error = kthread_add(taskqueue_thread_loop, tqp, p,
|
||||
&tq->tq_threads[i], RFSTOPPED, 0,
|
||||
"%s_%d", ktname, i);
|
||||
if (error) {
|
||||
@ -729,7 +729,20 @@ taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
|
||||
int error;
|
||||
|
||||
va_start(ap, name);
|
||||
error = _taskqueue_start_threads(tqp, count, pri, NULL, name, ap);
|
||||
error = _taskqueue_start_threads(tqp, count, pri, NULL, NULL, name, ap);
|
||||
va_end(ap);
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
taskqueue_start_threads_in_proc(struct taskqueue **tqp, int count, int pri,
|
||||
struct proc *proc, const char *name, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int error;
|
||||
|
||||
va_start(ap, name);
|
||||
error = _taskqueue_start_threads(tqp, count, pri, NULL, proc, name, ap);
|
||||
va_end(ap);
|
||||
return (error);
|
||||
}
|
||||
@ -742,7 +755,7 @@ taskqueue_start_threads_cpuset(struct taskqueue **tqp, int count, int pri,
|
||||
int error;
|
||||
|
||||
va_start(ap, name);
|
||||
error = _taskqueue_start_threads(tqp, count, pri, mask, name, ap);
|
||||
error = _taskqueue_start_threads(tqp, count, pri, mask, NULL, name, ap);
|
||||
va_end(ap);
|
||||
return (error);
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
struct taskqueue;
|
||||
struct taskqgroup;
|
||||
struct proc;
|
||||
struct thread;
|
||||
|
||||
struct timeout_task {
|
||||
@ -75,7 +76,9 @@ struct taskqueue *taskqueue_create(const char *name, int mflags,
|
||||
taskqueue_enqueue_fn enqueue,
|
||||
void *context);
|
||||
int taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
|
||||
const char *name, ...) __printflike(4, 5);
|
||||
const char *name, ...) __printflike(4, 5);
|
||||
int taskqueue_start_threads_in_proc(struct taskqueue **tqp, int count,
|
||||
int pri, struct proc *p, const char *name, ...) __printflike(5, 6);
|
||||
int taskqueue_start_threads_cpuset(struct taskqueue **tqp, int count,
|
||||
int pri, cpuset_t *mask, const char *name, ...) __printflike(5, 6);
|
||||
int taskqueue_enqueue(struct taskqueue *queue, struct task *task);
|
||||
|
Loading…
Reference in New Issue
Block a user