From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752488AbcKIIBU (ORCPT ); Wed, 9 Nov 2016 03:01:20 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:56967 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbcKIIBT (ORCPT ); Wed, 9 Nov 2016 03:01:19 -0500 Date: Wed, 9 Nov 2016 08:58:36 +0100 (CET) From: Thomas Gleixner To: Oleg Nesterov cc: Andy Lutomirski , Roman Pen , Andy Lutomirski , Peter Zijlstra , Ingo Molnar , Tejun Heo , "linux-kernel@vger.kernel.org" , Chunming Zhou , Alex Deucher Subject: Re: [PATCH 1/2] kthread: don't use to_live_kthread() in kthread_stop() In-Reply-To: <20161031200754.GB19430@redhat.com> Message-ID: References: <20161025110508.9052-1-roman.penyaev@profitbricks.com> <20161025140333.GB4326@redhat.com> <20161025154301.GA12015@redhat.com> <20161026141359.GA6893@redhat.com> <20161026155155.GA28832@redhat.com> <20161028161106.GA8933@redhat.com> <20161031200729.GA19430@redhat.com> <20161031200754.GB19430@redhat.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 31 Oct 2016, Oleg Nesterov wrote: > kthread_stop() had to use to_live_kthread() simply because it was not > possible to access kthread->exited after the exiting kthread clears > task_struct->vfork_done. Now that to_kthread() is always valid we can > do wake_up_process() + wait_for_completion() unconditionally, we don't > care if it has already passed complete_vfork_done() or even dead. > > The exiting kthread can get the spurious wakeup after mm_release() but > this is possible without this change too and this is fine, do_task_dead() > ensures that this can't make any harm. > > Note: we can even change this function to use task_work_add() and avoid > ->vfork_done altogether, probably we will do this later. > > Signed-off-by: Oleg Nesterov Reviewed-by: Thomas Gleixner