lkml.org 
[lkml]   [2020]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2020-12-20 15:00    [W:0.066 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site