From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S265136AbUADEz6 (ORCPT ); Sat, 3 Jan 2004 23:55:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S265137AbUADEz6 (ORCPT ); Sat, 3 Jan 2004 23:55:58 -0500 Received: from x35.xmailserver.org ([69.30.125.51]:22912 "EHLO x35.xmailserver.org") by vger.kernel.org with ESMTP id S265136AbUADEzz (ORCPT ); Sat, 3 Jan 2004 23:55:55 -0500 X-AuthUser: davidel@xmailserver.org Date: Sat, 3 Jan 2004 20:55:57 -0800 (PST) From: Davide Libenzi X-X-Sender: davide@bigblue.dev.mdolabs.com To: Rusty Russell cc: Linus Torvalds , Andrew Morton , , Linux Kernel Mailing List Subject: Re: [PATCH 1/2] kthread_create In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 3 Jan 2004, Davide Libenzi wrote: > On Sun, 4 Jan 2004, Rusty Russell wrote: > > > In message you write: > > > Rusty, I took a better look at the patch and I think we can have > > > per-kthread stuff w/out littering the task_struct and by making the thing > > > more robust. > > > > Except sharing data with a lock is perfectly robust. > > > > > We keep a global list_head protected by a global spinlock. We > > > define a structure that contain all the per-kthread stuff we need > > > (including a task_struct* to the kthread itself). When a kthread starts it > > > will add itself to the list, and when it will die it will remove itself > > > from the list. > > > > Yeah, I deliberately didn't implement this, because (1) it seems like > > a lot of complexity when using a lock and letting them share a single > > structure works fine and is even simpler, and (2) the thread can't > > just "do_exit()". > > > > You can get around (2) by having a permenant parent "kthread" thread > > which is a parent to all the kthreads (it'll get a SIGCHLD when > > someone does "do_exit()"). But the implementation was pretty ugly, > > since it involved having a communications mechanism with the kthread > > parent, which means you have the global ktm_message-like-thing for > > this... > > You will lose in any case. What happens if the thread does do_exit() and > you do kthread_stop() after that? > With the patch I posted to you, the kthread_stop() will simply miss the > lookup and return -ENOENT. Nope, we are screwed in any case. Is it really important to give the ability to do do_exit() for kthreads? I mean, why a simple return would not work? - Davide