Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759419AbcJYSRU (ORCPT ); Tue, 25 Oct 2016 14:17:20 -0400 Received: from mail-yw0-f172.google.com ([209.85.161.172]:35936 "EHLO mail-yw0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752240AbcJYSRM (ORCPT ); Tue, 25 Oct 2016 14:17:12 -0400 MIME-Version: 1.0 In-Reply-To: <20161025160806.GA13257@redhat.com> References: <20161025110357.8821-1-roman.penyaev@profitbricks.com> <20161025125615.GA4326@redhat.com> <20161025141920.GC4326@redhat.com> <20161025155712.GA12546@redhat.com> <20161025160806.GA13257@redhat.com> From: Roman Penyaev Date: Tue, 25 Oct 2016 20:15:56 +0200 Message-ID: Subject: Re: [PATCH v3 1/1] workqueue: ignore dead tasks in a workqueue sleep hook To: Oleg Nesterov Cc: Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Tejun Heo , linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1292 Lines: 36 On Tue, Oct 25, 2016 at 6:08 PM, Oleg Nesterov wrote: > sorry for noise, forgot to mention... > > On 10/25, Oleg Nesterov wrote: >> >> On 10/25, Oleg Nesterov wrote: >> > >> > void oops_end_exit(void) >> > { >> > current->flags &= ~PF_WQ_WORKER; >> > perhaps sonething else; >> > } >> > >> > called by oops_end() before rewind_stack_do_exit() ? >> >> and "perhaps sonething else" above should probably clear current->plug, >> it likely points to "struct blk_plug" on stack. >> >> and perhaps call task_work_run(). Currently only irq_thread() uses the >> "destructor" work on stack, but think can have more users. > > and, probably absorb some code from do_exit(), say set_fs(USER_DS) and/or > PF_EXITING check. I agree that for stack which was rewound we need more cleanups. But in the current patch I do not want to mix several cases. Here I try to avoid access to a NULL pointer of a dead task. That is not related to a corrupted stack. Regarding the PF_WQ_WORKER flags. I liked the idea that workqueue itself should be able to detect that task is dead. Spreading the code which does flags cleanup for a special workqueue case IMO is not nice. And, indeed, PF_EXITING looks more generic. Thanks. I will resend this. -- Roman