From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 3 21:40:02 2008 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09C9710659E6; Wed, 3 Sep 2008 21:40:02 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id BDD968FC13; Wed, 3 Sep 2008 21:40:01 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id m83LExFA060367; Wed, 3 Sep 2008 17:14:59 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id m83LExrj060366; Wed, 3 Sep 2008 17:14:59 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Wed, 3 Sep 2008 17:14:59 -0400 From: David Schultz To: kr Lekha Message-ID: <20080903211459.GA60350@zim.MIT.EDU> Mail-Followup-To: kr Lekha , Rui Paulo , freebsd-hackers@FreeBSD.ORG References: <96b2ec350809030134j73a61369m35395391a1218975@mail.gmail.com> <20080903095605.GB21178@alpha.local> <96b2ec350809030516y2d6f26d1h3cd7eb39231c4da0@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <96b2ec350809030516y2d6f26d1h3cd7eb39231c4da0@mail.gmail.com> Cc: freebsd-hackers@FreeBSD.ORG, Rui Paulo Subject: Re: killing a kthread X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Sep 2008 21:40:02 -0000 On Wed, Sep 03, 2008, kr Lekha wrote: > I understand when thread finishes it should call kthread_exit(). > but if this thread was suspended before it finished, it might not be able to > call kthread_exit(). > > Due to which we still see the thread suspended. I am unable to kill it > even with killproc / psignal with in the kernel module. That's by design. Kernel threads can hold arbitrary kernel resources, and there's no mechanism to clean up after them automatically. They are expected to clean up after themselves and exit gracefully. In your case, you'll need to wake up the suspended thread and somehow notify it that you want it to terminate.