[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201220135803.GA16470@redhat.com>
Date: Sun, 20 Dec 2020 14:58:03 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Pavel Begunkov <asml.silence@...il.com>
Cc: Al Viro <viro@...iv.linux.org.uk>, linux-kernel@...r.kernel.org,
Jens Axboe <axboe@...nel.dk>
Subject: Re: [RFC] exit: do exit_task_work() before shooting off mm
On 12/20, Pavel Begunkov wrote:
>
> On 08/12/2020 01:37, Al Viro wrote:
> > On Thu, Dec 03, 2020 at 02:30:46AM +0000, Pavel Begunkov wrote:
> >> Handle task works and lock it earlier before it starts killing off
> >> task's resources like mm. io_uring makes use of it a lot and it'd
> >> nicer to have all added task_work finding tasks in a consistent state.
I too do not understand this patch. task_work_add() will fail after
exit_task_work(). This means that, for example, exit_files() will use
schedule_delayed_work().
> One more moment, after we've set PF_EXITING any task_work_run() would be
> equivalent to exit_task_work()
Yes, currently task_work_run() can not be called after exit_signals().
And shouldn't be called imo ;)
> io_uring
> may want (currently doesn't) to run works for cancellation purposes.
Please see https://lore.kernel.org/io-uring/20200407163816.GB9655@redhat.com/
> Shouldn't it be like below (not tested)? Also simplifies task_work_run().
I'd prefer the patch from the link above, but your version looks correct too.
However, I still think it would be better to not abuse task_work_run() too
much...
Oleg.
Powered by blists - more mailing lists