Is there a way to get a list of all pages owned by a process in Linux kernel? I would need to call 'page_free()'on those pages. Please let me know!!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
If you want get a list of all the physical pages to collect state, you can write a small kernel module to achieve this, declare a struct page *p for (for physical page on the system), there is a exported symbol ./mm/memory.c:mem_map pointing to the page with PFN = 0. You can use get_num_physpage() to get total number of physical pages. Then you should be able to walk to the array to get physical page stats.
If its all pages of a process: it looks like you have to walk the page tables of a process
hope this helps!