[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231128165945.GD22743@redhat.com>
Date: Tue, 28 Nov 2023 17:59:45 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Christian Brauner <brauner@...nel.org>
Cc: NeilBrown <neilb@...e.de>, Al Viro <viro@...iv.linux.org.uk>,
Jens Axboe <axboe@...nel.dk>,
Chuck Lever <chuck.lever@...cle.com>,
Jeff Layton <jlayton@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-nfs@...r.kernel.org
Subject: Re: [PATCH/RFC] core/nfsd: allow kernel threads to use task_work.
On 11/28, Christian Brauner wrote:
>
> Yeah, I had played with that as well. Only reason I didn't do it was to
> avoid a PF_* flag. If that's preferable it might be worth to just add
> PF_TASK_WORK and decouple this from PF_KTHREAD.
OK, I won't insist.
But,
> + /*
> + * By default only non-kernel threads can use task work. Kernel
> + * threads that manage task work explicitly can add that flag in
> + * their kthread callback.
> + */
> + if (!args->kthread)
> + p->flags |= PF_TASK_WORK;
The comment and the name of the new flag look a bit misleading to me...
kthreads can use task_work's. You can create a kthread which does
task_work_run() from time to time and use task_work_add() on it,
nothing wrong with that.
Probably nobody does this right now (I didn't try to check), but please
note irq_thread()->task_work_add(on_exit_work).
Oleg.
Powered by blists - more mailing lists