lkml.org 
[lkml]   [2016]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 1/1] workqueue: ignore dead tasks in a workqueue sleep hook
On 10/25, Roman Pen wrote:
>
> void wq_worker_waking_up(struct task_struct *task, int cpu)
> {
> - struct worker *worker = kthread_data(task);
> + struct worker *worker;
> +
> + if (task->flags & PF_EXITING) {
> + /*
> + * Careful here, t->vfork_done is zeroed out for
> + * almost dead tasks, do not touch kthread_data().
> + */
> + return;
> + }
> +
> + worker = kthread_data(task);
>
> if (!(worker->flags & WORKER_NOT_RUNNING)) {
> WARN_ON_ONCE(worker->pool->cpu != cpu);
> @@ -875,9 +885,19 @@ void wq_worker_waking_up(struct task_struct *task, int cpu)
> */
> struct task_struct *wq_worker_sleeping(struct task_struct *task)
> {
> - struct worker *worker = kthread_data(task), *to_wakeup = NULL;
> + struct worker *worker, *to_wakeup = NULL;
> struct worker_pool *pool;
>
> + if (task->flags & PF_EXITING) {
> + /*
> + * Careful here, t->vfork_done is zeroed out for
> + * almost dead tasks, do not touch kthread_data().
> + */
> + return NULL;
> + }
> +
> + worker = kthread_data(task);
> +

Please see the patch I send a minute ago. With that patch we do not need
this fix, kthread_data() no longer uses ->vfork_done.

Oleg.

\
 
 \ /
  Last update: 2016-10-26 16:25    [W:0.044 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site