This changeset contains self-validations as a test driver.
I haven't seen any behavior changes between old and new implementations.
I will upload a version without self-test later.
make buildworld -j <hight number> causes lots of page in/out and is a
good test case
I analyzed the difference with the dtrace code below:
fbt::swap_pager_haspage:entry
{
self->ts = timestamp;
}
fbt::swap_pager_haspage:return
/self->ts/
{
@count["swap_pager_haspage count"] = count();
@avg["swap_pager_haspage average time"] = avg(timestamp - self->ts);
@sum["swap_pager_haspage total time"] = sum(timestamp - self->ts);
self->ts = 0;
}
I wanted to measure swp_meta_lookup but somehow dtrace -l did not list swp_meta_
lookup probe. So, I measured swap_pager_haspage() which calls the
swp_meta_lookup.
The results are from running buildworld from the 2 kernels with the same
base with and without the patch.
The system was setup in Parallels VM with 1.5 GB physical memory and 10GB swap s
pace on SSD.
r357119M: /usr/src/usr/obj/i386.i386/sys/GENERIC-NODEBUG i386
swap_pager_haspage count 33807456
swap_pager_haspage average time 12867
swap_pager_haspage total time 435000565713
r357119M: /usr/obj/mnt/sys/swp_meta_lookup/i386.i386/sys/GENERIC-NODEBUG i386
swap_pager_haspage count 88970
swap_pager_haspage average time 8397
swap_pager_haspage total time 747098759
average time is about 50% faster.
number of calls are reduced by about 380 times lesser.
total time is reduced by about 60 times lesser.
The speed up per each call is 50% faster and it sounds somewhat reasonable.
However, I am not sure why the total number of calls are reduced so much.
The challange of running dtrace for swap-in/swap-out is that
OOM killer frequently killed dtrace during low memory.
I had my dtrace killed nearly a half a hundred times in the past couple
of months of trying to measure the performance gain.