Loss of detail from kthreads

Julian Elischer julian at elischer.org
Tue Nov 13 17:25:14 PST 2007

Kris Kennaway wrote:
> Hi,
> Since the conversion from kprocs to kthreads there is a loss of 
> precision in how kernel process names are reported, because they now 
> mostly report the kproc name which is very generic.
> e.g. if you only use top -S then you only have "idle", "intr" processes, 
> etc.  You have to use top -SH, but then you also see the userland 
> threads, and there might be hundreds of them obscuring the kernel 
there were dozens of interrupt threads obscuring things too.
now there aren't. 
Sounds like you'd like an option -K to just look at the kernel?

top -K

> threads.  Also, ps now only displays the kproc:
well if you ask it to it'' show the kthreads.
root at trafmon1:ps -opid,tdnam,comm -xH
    0                     kernel
    1                     init
    2                     g_event
    3                     g_up
    4                     g_down
    5                     thread taskq
    6                     acpi_task_0
    7                     acpi_task_1
    8                     acpi_task_2
    9                     kqueue taskq
   10                     audit
   11 idle: cpu3          idle/idle: cpu3
   11 idle: cpu2          idle/idle: cpu2
   11 idle: cpu1          idle/idle: cpu1
   11 idle: cpu0          idle/idle: cpu0
   12 swi4: clock sio     intr/swi4: clock sio
   12 swi3: vm            intr/swi3: vm
   12 swi1: net           intr/swi1: net
   12 swi5: +             intr/swi5: +
   12 swi6: Giant task    intr/swi6: Giant task
   12 swi6: task queue    intr/swi6: task queue
   12 swi2: cambio        intr/swi2: cambio
   12 irq9: acpi0         intr/irq9: acpi0
   12 swi0: uart sio      intr/swi0: uart sio
   12 irq14: ata0         intr/irq14: ata0
   12 irq15: ata1         intr/irq15: ata1
   12 irq28: bge0         intr/irq28: bge0
   12 irq29: bge1         intr/irq29: bge1
   12 irq20: fxp0         intr/irq20: fxp0
   12 irq1: atkbd0        intr/irq1: atkbd0
   12 irq12: psm0         intr/irq12: psm0
   13                     yarrow

if you want that done by default someway then let's hear
what you'd like to do..

My plan is to add a -K option that is the equivalent of -SH in top
and the above in ps. I haven't investigated allthe versions of ps
yet to decide what it should be.

we could make -S in top show all the kernel threads if you wanted to..
but that's a bikeshed I'll let you fight..
it would be  relatively trivial change to do this..

> root      12 100.0  0.0     0   136  ??  RL   Sat01PM   6:28.30 [intr]
> so you can't see which interrupt(s) are using CPU.
> Finally, I noticed that DDB only displays the kproc name in e.g. allpcpu:
> cpuid        = 1
> curthread    = 0xcb41da50: pid 12 "intr"
> curpcb       = 0xe992cd90
> fpcurthread  = none
> idlethread   = 0xc67b7420: pid 11 "idle"
> APIC ID      = 1
> currentldt   = 0x50
> Probably other things are also affected.  All of these make kernel 
> analysis and debugging much less convenient, so this seems to me to be a 
> step backwards.  Are you still working on fixing these issues?

yes but distracted by $DAYJOB

ddb shows the thread name if you do  'ps'

I think pcpu should always show the thread name if it exists.

> Kris

More information about the freebsd-current mailing list