如何获取属于某个进程的所有页面的列表(Linux) [英] How to get list of all pages that belong to a process (linux)

查看:254
本文介绍了如何获取属于某个进程的所有页面的列表(Linux)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以获取Linux内核中某个进程拥有的所有页面的列表? 我需要在这些页面上调用"page_free()".请让我知道!!

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

推荐答案

如果要获取要收集状态的所有物理页面的列表,可以编写一个小的内核模块来实现此目的,为此声明一个结构页面* p (对于系统上的物理页面),有一个导出符号./mm/memory.c:mem_map指向PFN = 0的页面.您可以使用get_num_physpage()来获取物理页面的总数.然后,您应该能够走到该阵列以获取物理页面统计信息.

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

希望这会有所帮助!

这篇关于如何获取属于某个进程的所有页面的列表(Linux)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆