From owner-freebsd-current@FreeBSD.ORG Thu Aug 13 07:49:28 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21CC9106564A for ; Thu, 13 Aug 2009 07:49:28 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id DF2038FC57 for ; Thu, 13 Aug 2009 07:49:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 921DFFF6E; Thu, 13 Aug 2009 19:30:07 +1200 (NZST) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yN0jWu0yx6Ij; Thu, 13 Aug 2009 19:30:02 +1200 (NZST) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Thu, 13 Aug 2009 19:30:02 +1200 (NZST) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 6211B11432; Thu, 13 Aug 2009 19:30:02 +1200 (NZST) Date: Thu, 13 Aug 2009 00:30:02 -0700 From: Andrew Thompson To: current@freebsd.org Message-ID: <20090813073002.GA66860@citylink.fud.org.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) Cc: Hans Petter Selasky Subject: usb kthreads 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: Thu, 13 Aug 2009 07:49:28 -0000 Hi, Here is an aesthetic patch to change the usb kernel processes to threads, this hides them from the usual 'ps' output. Please test and review. 1290 ?? DL 0:00.00 [usbus0] [lots and lots more...] 1309 ?? DL 0:00.00 [usbus4] After the patch they can be seen as kernel threads. PID TID COMM TDNAME CPU PRI STATE WCHAN 0 100000 kernel swapper 0 68 sleep sched 0 100009 kernel firmware taskq 0 92 sleep - 0 100020 kernel kqueue taskq 0 92 sleep - 0 100021 kernel acpi_task_0 0 92 sleep - 0 100022 kernel acpi_task_1 0 92 sleep - 0 100023 kernel acpi_task_2 0 92 sleep - 0 100027 kernel thread taskq 0 92 sleep - 0 100031 kernel bwi0 taskq 0 16 sleep - 0 100032 kernel bwi0 taskq 0 16 sleep - 0 100106 kernel usbus0 0 20 sleep wmsg 0 100107 kernel usbus0 0 16 sleep wmsg 0 100108 kernel usbus0 0 20 sleep wmsg 0 100109 kernel usbus0 0 20 sleep wmsg [ ... ] 0 100127 kernel usbus4 0 20 sleep wmsg Andrew Index: dev/usb/usb_process.c =================================================================== --- dev/usb/usb_process.c (revision 196086) +++ dev/usb/usb_process.c (working copy) @@ -64,9 +64,9 @@ #if (__FreeBSD_version >= 800000) #define USB_THREAD_CREATE(f, s, p, ...) \ - kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) -#define USB_THREAD_SUSPEND(p) kproc_suspend(p,0) -#define USB_THREAD_EXIT(err) kproc_exit(err) + kthread_add((f), (s), NULL, (p), 0, 0, __VA_ARGS__) +#define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) +#define USB_THREAD_EXIT(err) kthread_exit() #else #define USB_THREAD_CREATE(f, s, p, ...) \ kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) Index: dev/usb/usb_process.h =================================================================== --- dev/usb/usb_process.h (revision 196086) +++ dev/usb/usb_process.h (working copy) @@ -49,7 +49,7 @@ struct usb_process { struct cv up_cv; struct cv up_drain; - struct proc *up_ptr; + struct thread *up_ptr; struct thread *up_curtd; struct mtx *up_mtx;