After third week, we started coding and made basic things. Our first aim to enable read-only ptes for collapsing. I still look for this issue. Something goes wrong and I can't see what is that.
To test my changes I've prepared test programs. They create pressure on memory and supply to swapped out system. Actually, they are very basic, just make malloc(), read/write operations on memory. memtest and stress are very strong workload programs, but to swapped out something they mix operations which are not correct for me. I should test specific conditions so use my test programs and they will be sophisticated later on.
To get informations about what happened with my changes, I use smem which shows swap usage percentage, pid, ppid with -t -p options and that's enough for me :). For specific process I look /proc/pid/smaps it gives anonhugepages/anonymouspages numbers and swap usage.
To look kernel messages we can use dmesg, but its size is not enough for me :) because I've been testing almost every line of the functions. To increase size of dmesg log, you should should set CONFIG_LOG_BUF_SHIFT in kernel config file. However When I setted it by 27 which means 2^27 bytes, make seems that doesn't accept this number! Probably, the number can be 16 or 17 as suggestion of config, but I'm not sure about that. Then I've looked /var/log/kern.log, and its size enough for me :) I'm sure about test results with it.
do_swap_page() makes swapped in operations afterward khugepaged scans the pages tables that come from do_swap_page(). There is no function call for khugepaged_scan_mm_slot(), it is called per 10000 miliseconds. Its call chain is like that:
khugepaged_scan_mm_slot() -> khugepaged_scan_pmd() -> collapse_huge_page() ->
Today I've realized in khugepaged_scan_pmd(), ptes seem unpresent! but they are swapped in. Then I need to look do_swap_page() again :).