My goal is to find out process-id of pages which are being swapped out. The Linux Kernel function swap_writepage()
takes a pointer to struct page as a part of formal argument while swapping a page on backing store. All swap-out operations are done by "kswapd" process. I need to find out pid(s) of the processes whose page is passed as argument in the swap_writepage()
function. In order to get that, I was able to find all page table entries associated with that page using rmap structures.
How can I get pid from a pte or from struct page? I have used sytemtap to get the value of struct page pointer, received in swap_writepage()
function as argument. Also, the pid()
function prints the pid of current process running not the pid of process to which that page belongs which always gives kswapd process.