From owner-freebsd-current@FreeBSD.ORG Thu Oct 25 20:34:03 2007 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 8EA5916A418 for ; Thu, 25 Oct 2007 20:34:03 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outI.internet-mail-service.net (outI.internet-mail-service.net [216.240.47.232]) by mx1.freebsd.org (Postfix) with ESMTP id 5F3B013C4B9 for ; Thu, 25 Oct 2007 20:34:03 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Thu, 25 Oct 2007 13:34:02 -0700 X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 9F416126809 for ; Thu, 25 Oct 2007 13:34:01 -0700 (PDT) Message-ID: <4720FDD6.4020505@elischer.org> Date: Thu, 25 Oct 2007 13:34:30 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: FreeBSD Current References: <4720335D.6020404@elischer.org> In-Reply-To: <4720335D.6020404@elischer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: kthread/kproc diff 2 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, 25 Oct 2007 20:34:03 -0000 This time with the pointer to the diff: http://www.freebsd.org/~julian/kthread.diff not that this diff makes tow new kprocs, one called idled (to which it assigns all the idle threads) and one called interd (to which it assigns all the interrupt threads) This is mainly just for aesthetic reasons. It looked silly to always have the kernel thread at 398% when nothing was happening, where it looks more understandable if the idled is showing 398%. A for the interrupts, well, it was low hanging fruit and it was easy to do. Once this is committed I (or others) can move other kprocs over to being kthreads as time permits... BTW specifying no kproc to put a new kthread into will result in the default behaviour of putting it into proc0. which has a process name of "kernel" now. (along with a thread called "swapper") Julian Elischer wrote: > newest version.. > > this version has been tested somewhat, and adds a new function. > the new function, when given a pointer to a pointer to a proc, will > make a new kproc when the proc * is NULL (i.e. the first time it is called) > and fill it in, and therafter, add new kthreads to that process. > > it has a rather clumsy name of kproc_kthread_create, so if you don't > like it sugeest something better.. it uses kproc_create and kthread_create. > > after applying this patch top -SH shows the following: > > last pid: 35036; load averages: 0.24, 0.05, 0.09 up 0+08:15:52 > 23:04:13 > 85 processes: 5 running, 62 sleeping, 18 waiting > CPU states: 0.1% user, 0.0% nice, 0.0% system, 0.0% interrupt, 99.9% > idle > Mem: 39M Active, 792M Inact, 138M Wired, 1060K Cache, 112M Buf, 2038M Free > Swap: 6144M Total, 6144M Free > > PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU COMMAND > 10 root 171 ki31 0K 32K CPU3 3 30.3H 98.97% {idle: cpu3} > 10 root 171 ki31 0K 32K CPU2 2 30.3H 98.97% {idle: cpu2} > 10 root 171 ki31 0K 32K CPU0 0 30.3H 98.58% {idle: cpu0} > 10 root 171 ki31 0K 32K RUN 1 30.3H 98.14% {idle: cpu1} > 25 root 20 - 0K 8K syncer 2 2:12 0.73% syncer > 11 root -32 - 0K 136K WAIT 0 15:55 0.54% {swi4: clock sio} > 11 root -24 - 0K 136K WAIT 0 15:55 0.00% {swi6: Giant task} > 11 root -24 - 0K 136K WAIT 1 15:55 0.00% {swi6: task queue} > 11 root -28 - 0K 136K WAIT 2 15:55 0.00% {swi5: +} > 11 root -36 - 0K 136K WAIT 0 15:55 0.00% {swi3: vm} > 11 root -40 - 0K 136K WAIT 0 15:55 0.00% {swi2: cambio} > 11 root -44 - 0K 136K WAIT 0 15:55 0.00% {swi1: net} > 11 root -48 - 0K 136K WAIT 0 15:55 0.00% {swi0: uart sio} > 11 root -52 - 0K 136K WAIT 0 15:55 0.00% {irq9: acpi0} > 11 root -60 - 0K 136K WAIT 0 15:55 0.00% {irq12: psm0} > 11 root -60 - 0K 136K WAIT 0 15:55 0.00% {irq1: atkbd0} > 11 root -64 - 0K 136K WAIT 0 15:55 0.00% {irq5: ohci0} > 11 root -64 - 0K 136K WAIT 0 15:55 0.00% {irq15: ata1} > 11 root -64 - 0K 136K WAIT 0 15:55 0.00% {irq14: ata0} > 11 root -68 - 0K 136K WAIT 0 15:55 0.00% {irq28: bge0} > 11 root -68 - 0K 136K WAIT 0 15:55 0.00% {irq20: fxp0} > 11 root -68 - 0K 136K WAIT 0 15:55 0.00% {irq29: bge1} > 19 root -68 - 0K 8K - 2 4:56 0.00% dummynet > 12 root -16 - 0K 8K - 1 0:16 0.00% yarrow > 2 root -8 - 0K 8K - 2 0:06 0.00% g_event > 3 root -8 - 0K 8K - 2 0:05 0.00% g_up > [etc] > > > top -S just shows: > > last pid: 35040; load averages: 0.09, 0.04, 0.08 up 0+08:16:48 > 23:05:09 > 85 processes: 5 running, 62 sleeping, 18 waiting > CPU states: 0.1% user, 0.0% nice, 0.0% system, 0.0% interrupt, 99.9% > idle > Mem: 39M Active, 792M Inact, 138M Wired, 1060K Cache, 112M Buf, 2038M Free > Swap: 6144M Total, 6144M Free > > PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND > 10 root 4 171 ki31 0K 32K CPU0 0 30.3H 396.09% idled > 11 root 17 -60 - 0K 136K WAIT 0 15:56 0.00% interd > 19 root 1 -68 - 0K 8K - 2 4:56 0.00% dummynet > 25 root 1 20 - 0K 8K syncer 1 2:12 0.00% syncer > [etc] > > other current kprocs can be turned into kthreads with minimal > (usually a few seconds) edits > > note kthread_create() has grown an extra argument, a struct proc * > that is used to tell it which kproc to add the thread to. > > > comments? > code-reviews? > > ps -auxH -Otdnam gives output different from what I'd expect > and strange messages appear on the console. so comments on that > (the ps diffs) are definitly requested. > > > > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"