lkml.org 
[lkml]   [2012]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v4 2/3] genirq: reimplement exit_irq_thread() hook via task_work_add()
Date
Oleg Nesterov <oleg@redhat.com> wrote:

> 2. change irq_thread() to do task_queue_work(irq_thread_dtor)
> at the start and task_work_cancel() before return.
>
> tracehook_notify_resume() can never play with kthreads,
> only do_exit()->exit_task_work() can call the callback
> and this is what we want.

Hmmm... This seems wrong. You're now using the hook in two distinct ways:
the primary use of that the hook is to detect that userspace is about to
resume processing (via TIF_NOTIFY_RESUME) and then you're abusing the fact
that the hook is also invoked via do_exit() to perform a clean up because
we've got to get rid of it somehow under that circumstance.

This only works for you because you're operating in a kernel thread which
doesn't have a userspace (and so will never see TIF_NOTIFY_RESUME). However,
if someone tries that in an ordinary thread, it is liable to malfunction as
the record could be executed and deleted at some unpredictable point in the
future.

David


\
 
 \ /
  Last update: 2012-04-17 16:13    [W:1.548 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site