• Kirill Smelkov's avatar
    virtmem: Benchmarks for pagefault handling · 3cfc2728
    Kirill Smelkov authored
    Benchmark the time it takes for virtmem to handle pagefault with noop
    loadblk for loadblk both implemented in C and in Python.
    
    On my computer it is:
    
    	name          µs/op
    	PagefaultC    269 ± 0%
    	pagefault_py  291 ± 0%
    
    Quite a big time in other words.
    
    It turned out to be mostly spent in fallocate'ing pages on tmpfs from
    /dev/shm. Part of the above 269 µs/op is taken by freeing (reclaiming)
    pages back when benchmarking work size exceed /dev/shm size, and part to
    allocating.
    
    If I limit the work size (via npage in benchmem.c) to be less than whole
    /dev/shm it starts to be ~ 170 µs/op and with additional tracing it
    shows as something like this:
    
        	.. on_pagefault_start   0.954 µs
        	.. vma_on_pagefault_pre 0.954 µs
        	.. ramh_alloc_page_pre  0.954 µs
        	.. ramh_alloc_page      169.992 µs
        	.. vma_on_pagefault     172.853 µs
        	.. vma_on_pagefault_pre 172.853 µs
        	.. vma_on_pagefault     174.046 µs
        	.. on_pagefault_end     174.046 ...
    3cfc2728
Makefile 6.04 KB