From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 3 09:06:19 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 294C3106564A for ; Wed, 3 Sep 2008 09:06:19 +0000 (UTC) (envelope-from kr.lekha@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.224]) by mx1.freebsd.org (Postfix) with ESMTP id F0A738FC23 for ; Wed, 3 Sep 2008 09:06:18 +0000 (UTC) (envelope-from kr.lekha@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so3746156rvf.43 for ; Wed, 03 Sep 2008 02:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=xMsex7NWOwOyiSjpOmDxctPOVDO3D+mTiTnQE0SCDfo=; b=R7HTGH+fTdDrr0JvOFz5P/pUIKm9vlwVhi1c29Y0r/H6AxQwkHNPBtl/k4/BtiO8z5 BKddawpp1vKAMqbI20PX8SlKW6TigkCbyfSMPi316+hJSqte9ofvbi17FIbq612hp4cU 9qTBh8Uf2zPI1grZhKbQOH2j/S7DTnJar5OQs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=S9gfomKFF0zPWuO08ejS3VCuMN9kIEidluII0oiZsdyFwhjxFOm4ijz1Zq/YEvxpXt P5M/Ltm7exqTw2xiG7VMvCkmnHbhhHeYqrtFzkO0cVGvDjzbot2tCPJbCCuH4Qthameb EAOmnXw0xeleb3zG9Yz5bJcDbgS5wt22Stzew= Received: by 10.141.164.13 with SMTP id r13mr4765576rvo.53.1220430887377; Wed, 03 Sep 2008 01:34:47 -0700 (PDT) Received: by 10.141.212.11 with HTTP; Wed, 3 Sep 2008 01:34:47 -0700 (PDT) Message-ID: <96b2ec350809030134j73a61369m35395391a1218975@mail.gmail.com> Date: Wed, 3 Sep 2008 09:34:47 +0100 From: "kr Lekha" To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: 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 09:06:19 -0000 Hi, i wanted to kill a kthread created by my module, There is no actual kthread_kill to kill it hence I tried to send kill signal to thread psignal(p, SIGTERM); psignal(p, SIGKILL); killproc(p,"messeage"); and kthread_suspend() Nothing seems to be killing the kthread, I still see it [root@ /usr/src]# ps awx -l | grep kernel UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND 0 1048 1 0 20 0 0 8 ktsusp DL ?? 0:00.01 [new_kernel_thread] I have noticed that generally if kernel module wanted to kill a thread then it calls { wakeup(p); msleep(p,0); /*or tsleep*/ } This puts the thread to sleep forever. However kthread_suspend also performs same actions. Does scheduler take care to killing it? I read that after 2 min scheduler wakes up the thread and eventually kills it, i see the same kthread suspended even after a day I would appreciate any thoughts in this reagard. Thanks, -lekha