kthread/kproc diff 2

From: Julian Elischer <julian_at_ironport.com>
Date: Wed, 24 Oct 2007 23:09:48 -0700
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.
Received on Thu Oct 25 2007 - 04:37:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:20 UTC