From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932768AbcJZOYk (ORCPT ); Wed, 26 Oct 2016 10:24:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46314 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932320AbcJZOYh (ORCPT ); Wed, 26 Oct 2016 10:24:37 -0400 Date: Wed, 26 Oct 2016 16:18:35 +0200 From: Oleg Nesterov To: Roman Pen Cc: Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Tejun Heo , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/1] workqueue: ignore dead tasks in a workqueue sleep hook Message-ID: <20161026141834.GB6893@redhat.com> References: <20161025182742.10486-1-roman.penyaev@profitbricks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161025182742.10486-1-roman.penyaev@profitbricks.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 26 Oct 2016 14:18:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.