Date: Sun, 9 Jul 2017 23:15:18 -0300 From: =?UTF-8?B?T3RhY8OtbGlv?= <otacilio.neto@bsd.com.br> To: freebsd-current <freebsd-current@freebsd.org> Subject: type of vm.stats.vm.v_vnodepgsin vm.stats.vm.v_swappgsin, vm.stats.vm.v_vnodepgsout vm.stats.vm.v_swappgsout on AMD64 r320730 Message-ID: <1c37db96-7cd2-91c9-011c-967a32a97f05@bsd.com.br>
next in thread | raw e-mail | index | archive | help
Dears
I'm the maintainer of xosview and I'm debugging rather weird behavior
from it in the latest FreeBSD 12 revisions (12.0-CURRENT #0 r320730
AMD64) . The problem is occurring on the lines responsible for
collecting statistics about paging. These lines follow:
If (pageinfo) {
Pageinfo [0] = (uint64_t) vm.v_vnodepgsin + (uint64_t) vm.v_swappgsin;
Pageinfo [1] = (uint64_t) vm.v_vnodepgsout + (uint64_t) vm.v_swappgsout;
}
This code works on FreeBSD 11 and until a short time ago it works at 12.
But now it returns extremely large values when interpreted as 64-bit
values. A debugging has shown that for this sysctl call the following
values are returned in the terminal:
sysctl vm.stats.vm.v_vnodepgsin vm.stats.vm.v_swappgsin
vm.stats.vm.v_vnodepgsout vm.stats.vm.v_swappgsout
Vm.stats.vm.v_vnodepgsin: 47432
Vm.stats.vm.v_swappgsin: 0
Vm.stats.vm.v_vnodepgsout: 19
Vm.stats.vm.v_swappgsout: 0
While the code returns things like:
Pageinf [0] = 34359785800; Pageinfo [1] = 140733193388051
Pageinf [0] = 34359785800; Pageinfo [1] = 2678138638516092947
After some tests I found that if I change the code to use a typecast to
(uint32_t) then Xosview works correctly.:
If (pageinfo) {
Pageinfo [0] = (uint32_t) ((uint64_t) vm.v_vnodepgsin + (uint64_t)
vm.v_swappgsin);
Pageinfo [1] = (uint32_t) ((uint64_t) vm.v_vnodepgsout + (uint64_t)
vm.v_swappgsout);
}
For me, it seems that some code in the kernel is storing values as 32
bits where it should be 64 bits. Is this behavior correct?
[]'s
-Otacílio
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1c37db96-7cd2-91c9-011c-967a32a97f05>
