Re: Processes in swapped out states in recent CURRENT?

From: Sergey Kandaurov <pluknet_at_gmail.com>
Date: Fri, 6 May 2011 10:28:48 +0400
On 6 May 2011 00:33, Garrett Cooper <yanegomi_at_gmail.com> wrote:
>    I was watching top output on my dev box and I noticed that there
> are more swapped out processes present on the system, shortly after
> boot (which doesn't make sense given that I'm not low on resources on
> the box). Also, the os when I run os.waitpid() in python claims that
> the child doesn't exist, so I'm wondering if there's an issue with the
> processes reported via ps, top, etc.
>    I'm noting this because it's a behavior change over my
> 'stable'-ish workstation, running CURRENT/r220089/amd64, which is
> spec'ed out the same as the dev box, minus some multimedia hardware.
> Thanks,
> -Garrett
>
> # uname -a
> FreeBSD fallout.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r221219M: Thu
> May  5 12:09:37 PDT 2011
> root_at_fallout.local:/usr/obj/usr/src/sys/FALLOUT  amd6
> # fstat -p 1832
> USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
> root     sshd        1832 root /             2 drwxr-xr-x    1024  r
> root     sshd        1832   wd /             2 drwxr-xr-x    1024  r
> root     sshd        1832 text /usr     730118 -r-xr-xr-x  240944  r
> root     sshd        1832    0 /dev          6 crw-rw-rw-    null  r
> root     sshd        1832    1 /dev          6 crw-rw-rw-    null rw
> root     sshd        1832    2 /dev          6 crw-rw-rw-    null rw
> root     sshd        1832    3* internet stream tcp fffffe01e56cf000
> root     sshd        1832    4* pseudo-terminal master      pts/1 rw
> root     sshd        1832    5* local stream fffffe0008f79960 <->
> fffffe0008f79a50
> # fstat -p 149
> USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
> root     adjkerntz    149 root /             2 drwxr-xr-x    1024  r
> root     adjkerntz    149   wd /             2 drwxr-xr-x    1024  r
> root     adjkerntz    149 text /        329805 -r-xr-xr-x    8792  r
> root     adjkerntz    149    0 /dev          6 crw-rw-rw-    null rw
> root     adjkerntz    149    1 /dev          6 crw-rw-rw-    null rw
> root     adjkerntz    149    2 /dev          6 crw-rw-rw-    null rw
> # fstat -p 1479
> USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
> root     syslogd     1479 root /             2 drwxr-xr-x    1024  r
> root     syslogd     1479   wd /             2 drwxr-xr-x    1024  r
> root     syslogd     1479 text /usr     739002 -r-xr-xr-x   39008  r
> root     syslogd     1479    0 /dev          6 crw-rw-rw-    null rw
> root     syslogd     1479    1 /dev          6 crw-rw-rw-    null rw
> root     syslogd     1479    2 /dev          6 crw-rw-rw-    null rw
> root     syslogd     1479    3 /var     353301 -rw-------       4  w
> root     syslogd     1479    4* local dgram fffffe0008cd31e0
> root     syslogd     1479    5* local dgram fffffe0008cd30f0
> root     syslogd     1479    6* internet6 dgram udp fffffe0008ced540
> root     syslogd     1479    7* internet dgram udp fffffe0008ced3f0
> root     syslogd     1479    8 /dev         29 crw-------    klog  r
> root     syslogd     1479   10 /var     1389613 -rw-r--r--   25389  w
> root     syslogd     1479   11 /var     1389579 -rw-------      62  w
> root     syslogd     1479   12 /var     1389572 -rw-------   10164  w
> root     syslogd     1479   13 /var     1389601 -rw-r-----    2814  w
> root     syslogd     1479   14 /var     1389575 -rw-r--r--      62  w
> root     syslogd     1479   15 /var     1389580 -rw-------      62  w
> root     syslogd     1479   16 /var     1389577 -rw-------   57212  w
> root     syslogd     1479   17 /var     1389606 -rw-------   38046  w
> root     syslogd     1479   18 /var     1389578 -rw-r-----      62  w
> # fstat -p 1829
> USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
> gcooper  sh          1829 root /             2 drwxr-xr-x    1024  r
> gcooper  sh          1829   wd /usr     1884160 drwxr-xr-x    1024  r
> gcooper  sh          1829 text /        212057 -r-xr-xr-x  131784  r
> gcooper  sh          1829    0 /dev        127 crw--w----   pts/0 rw
> gcooper  sh          1829    1 /dev        127 crw--w----   pts/0 rw
> gcooper  sh          1829    2 /dev        127 crw--w----   pts/0 rw
> gcooper  sh          1829   10 /dev        127 crw--w----   pts/0 rw
>
> # python -c 'import os; os.waitpid(1825, 0)'
> Traceback (most recent call last):
>  File "<string>", line 1, in <module>
> OSError: [Errno 10] No child processes

But pid 1825 (sshd) is not a child process of the python process , isn't it?

from waitpid(2):
     [ECHILD]           The calling process has no existing unwaited-for child
                        processes.

Look at /sys/kern/kern_exit.c:kern_wait(). The function returns ECHILD if
a specified process was not found among p->p_children children group.


> # ps auxww | grep 1825
> root     1825   0.0  0.0  47952      0  ??  IWs  -         0:00.00
> sshd: gcooper [priv] (sshd)
> root    88213   0.0  0.0  16340   1356   3  S+    1:25PM   0:00.00 grep 1825
> # top -b
> last pid: 96740;  load averages:  1.07,  0.98,  0.92  up 0+01:15:32    13:27:04
> 50 processes:  2 running, 48 sleeping
>
> Mem: 56M Active, 23M Inact, 795M Wired, 1848K Cache, 1237M Buf, 11G Free
> Swap: 24G Total, 832K Used, 24G Free
>
>
>  PID USERNAME  THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU
> COMMAND
>  1828 gcooper     1  20    0 47952K  3372K select  6   0:02  0.00% sshd
> 26295 root        1  20    0  9972K   888K kqread  2   0:01  0.00% tail
> 95888 root        1  52    0 14472K  8092K wait    1   0:00  0.00% make
>  1729 root        1  20    0 20368K  3000K select  2   0:00  0.00% sendmail
> 59474 gcooper     1  20    0 47952K  3768K select  7   0:00  0.00% sshd
> 57339 root        1  52    0  6280K  1168K wait    1   0:00  0.00% make
> 75210 gcooper     1  20    0 47952K  3816K select  5   0:00  0.00% sshd
> 82431 root        1  52    0  6280K  1148K wait    2   0:00  0.00% make
> 94797 root        1  52    0  6280K  1164K wait    2   0:00  0.00% make
> 59441 root        1  21    0 47952K  3772K sbwait  4   0:00  0.00% sshd
>  1825 root        1  21    0 47952K     0K sbwait  1   0:00  0.00% <sshd>
> 75167 root        1  21    0 47952K  3820K sbwait  1   0:00  0.00% sshd
>  1832 root        1  20    0 47952K     0K sbwait  1   0:00  0.00% <sshd>
> 96738 root        1  72    0 17184K  9756K CPU0    0   0:00  0.00% cc1
>  1479 root        1  20    0 12228K  1372K select  4   0:00  0.00% syslogd
> 75237 root        1  20    0 17612K  2424K ttyin   4   0:00  0.00% bash
>  1835 gcooper     1  20    0 47952K  3284K select  2   0:00  0.00% sshd
> 57233 root        1  52    0  6280K   756K wait    2   0:00  0.00% make


-- 
wbr,
pluknet
Received on Fri May 06 2011 - 04:28:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:13 UTC