user3788234
user3788234

Reputation: 61

How to get list of all pages that belong to a process (linux)

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!!

Upvotes: 1

Views: 1356

Answers (1)

askb
askb

Reputation: 6768

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!

Upvotes: 2

Related Questions