From owner-freebsd-current@FreeBSD.ORG Wed Sep 3 10:04:31 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2CBD1065671 for ; Wed, 3 Sep 2008 10:04:31 +0000 (UTC) (envelope-from kr.lekha@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.236]) by mx1.freebsd.org (Postfix) with ESMTP id 850348FC23 for ; Wed, 3 Sep 2008 10:04:31 +0000 (UTC) (envelope-from kr.lekha@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so3772356rvf.43 for ; Wed, 03 Sep 2008 03:04:31 -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=H0ktQUyA2KCyS1Be9Zx248s8VuCl0eLMwMxcL4G+cFo=; b=ir0pnL99LdsQYSxBpDHHTa6vygjn/A+7bdovnGIU2I17r4jV+CCuuAKSbYQP3FjgvQ lVi1vhFaAfxZ+cuBUOd9gjoi6bXbvwZ3Th/3cznQCbk925rYHKSgV3j6gzoBknVsYsOL MU+xA1vYEPdGIl/yE0oR/stSk067W4VewuKw0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=tvn04OdFljfPhAEbnRnamEvHFMRgv6LL7PiRrtMZBrrQm0Qoz4sFj3S0Gka3L8LhE9 teUQLsAXmrOt5gMVqIt3hvVaddVBp0nnda12pKR5AebaWtUw7UgkM+U/JH6pegZl1Xnr WzGg7yQb4f81g5QoQ9g9DhAjqqAj6cIEECQlk= Received: by 10.141.168.16 with SMTP id v16mr4765654rvo.233.1220434320864; Wed, 03 Sep 2008 02:32:00 -0700 (PDT) Received: by 10.141.212.11 with HTTP; Wed, 3 Sep 2008 02:32:00 -0700 (PDT) Message-ID: <96b2ec350809030232v5586ea44nf6ead7d856f72634@mail.gmail.com> Date: Wed, 3 Sep 2008 10:32:00 +0100 From: "kr Lekha" To: freebsd-current@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: Kthread kill X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Sep 2008 10:04:31 -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