Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Oct 2015 21:28:15 +0800
From:      Jia-Shiun Li <jiashiun@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   vmtotal consumes significant portion of cpu cycles
Message-ID:  <CAHNYxxOWqAZxt%2BZcjU_JnUhE5n7%2BCbwv-_6yTOy1bOaYS=Z4gw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi all,

I noticed that 'sysctl -vm 1' consumes about 5% cpu time on a machine with
2x 6-core Xeon E5v3 and 64GB memory. That's a lot for a monitoring tool.

After digging a while I found that it is vmtotal() in kernel that consumes
major cycles. When memory usage is high the cost of vmtotal() rises too. It
is reproducible with sysctl when memory utilization is high:

% time repeat 100 sysctl vm.vmtotal > /dev/null
0.055u 8.102s 0:08.19 99.5% 31+175k 0+0io 0pf+0w

% top
last pid: 40272;  load averages:  0.32,  4.74,  8.01    up 3+01:19:54
 17:23:59
58 processes:  1 running, 57 sleeping
CPU:  0.1% user,  0.0% nice,  1.6% system,  0.1% interrupt, 98.3% idle
Mem: 4509M Active, 52G Inact, 2819M Wired, 1572M Buf, 2930M Free
Swap: 3598M Total, 3598M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME     CPU
COMMAND
46841 root         30  20    0  9248M  7930M kqread  9  20.8H  11.88% bhyve
49914 jsli          1  23    0 19320K  3884K select  5 134:08   4.79% systat


In FreeBSD source tree systat and vmstat are major user. Other tools like
bsnmpd may use it  too via sysctl.

I don't have idea yet how this can be improved. Shall I create a bug to
keep track of it?


-Jia-Shiun



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHNYxxOWqAZxt%2BZcjU_JnUhE5n7%2BCbwv-_6yTOy1bOaYS=Z4gw>