3

I am a little confused about the status of a process I have. It looks like this:

$ ps -eal | head -n 1 ; ps -eal | grep perf
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S     0  7843  7842  0  80   0 - 10838 -      pts/6    00:00:00 perf

-- so, the status is S, which the man page describes as "S interruptible sleep (waiting for an event to complete)", it is waiting for some event. I assume it is listed in some waiting channel. But the waiting channel is: WCHAN -. Which man page describes with "Running tasks will display a dash ('-') in this column."

Plus, /proc/7843/status indeed contains State: S (sleeping) and /proc/7843/wchan contains 0. I guess 0 in proc//wchan tells the same thing -- that the task does not wait for anything.

Do I misunderstand something or do they contradict one another?

And the task indeed does not run -- I don't think - in wchan means it is waiting to be scheduled..

Could the wchan output be somehow misconfigured? I run Ubuntu 14.04, kernel 3.13.0-86-generic.

Checking other process shows:

$ ps -eal | head -n 1 ; ps -eal | grep fish
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
0 S  1000  2407  2399  0  80   0 - 47675 wait   pts/0    00:00:07 fish
1 S  1000  2409     1  0  80   0 -  5500 poll_s ?        00:00:00 fishd
0 S  1000  2507  2399  0  80   0 - 45333 poll_s pts/3    00:00:00 fish
0 S  1000  2567     1  0  80   0 -  8366 wait   ?        00:00:00 fish

-- so here WCHAN is ok.

1

The WCHAN value seems to be computed. From kernel sources arch/x86/Kconfig:

config SCHED_OMIT_FRAME_POINTER 
   Single-depth WCHAN output
   Calculate simpler /proc/<PID>/wchan values. If this option
   is disabled then wchan values will recurse back to the
   caller function. This provides more accurate wchan values,
   at the expense of slightly more scheduling overhead.

and from Documentation/filesystem/proc.txt:

wchan Present with CONFIG_KALLSYMS=y: it shows the kernel function
      symbol the task is blocked in - or "0" if not blocked.

so I guess sometimes there is a miscomputation of wchan.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.