From owner-freebsd-current@FreeBSD.ORG Thu Oct 25 06:37:59 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 E1D1916A417 for ; Thu, 25 Oct 2007 06:37:59 +0000 (UTC) (envelope-from prvs=julian=811a7a5ee@ironport.com) Received: from c60-outbound.ironport.com (c60-outbound.ironport.com [63.251.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id C922F13C49D for ; Thu, 25 Oct 2007 06:37:59 +0000 (UTC) (envelope-from prvs=julian=811a7a5ee@ironport.com) DomainKey-Signature: s=key512; d=ironport.com; c=nofws; q=dns; h=Received:Message-ID:Date:From:User-Agent:MIME-Version: To:Subject:Content-Type; b=b/9xMs/dybokPKckHUCCs+uMU9rZ/XR07ExGwegDJiP2E1X66zLrw 0gI/P1weS8mRfd12OOjNyAcFC8nQNs/Ow==; Received: from unknown (HELO julian-mac.elischer.org) ([10.251.60.159]) by c60-outbound.ironport.com with ESMTP; 24 Oct 2007 23:09:21 -0700 Message-ID: <4720332C.8050601@ironport.com> Date: Wed, 24 Oct 2007 23:09:48 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: FreeBSD Current Content-Type: multipart/mixed; boundary="------------040607020402030903030509" X-Mailman-Approved-At: Thu, 25 Oct 2007 11:16:08 +0000 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: 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 06:38:00 -0000 This is a multi-part message in MIME format. --------------040607020402030903030509 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------040607020402030903030509--