Linux - 识别在物理内存中拥有特定地址的进程

标签 linux module linux-kernel kernel

在 Linux 下,我如何知道哪个特定进程拥有/正在使用物理内存中的给定地址?

我知道这可能需要编写一个内核模块来访问一些内核数据结构并将结果返回给用户 - 我需要知道如何完成它,无论它有多复杂。

最佳答案

进程使用的页面及其在物理内存中的位置不是静态信息。但是,您查找的信息应该在page tables 中。 . change进入内核可能几乎正是您正在寻找的东西:

author  Arjan van de Ven <arjan@linux.intel.com>    2008-04-17 15:40:45 (GMT) 
committer   Ingo Molnar <mingo@elte.hu>                 2008-04-17 15:40:45 (GMT)
commit  926e5392ba8a388ae32ca0d2714cc2c73945c609 (patch)
tree    2718b50b8b66a3614f47d3246b080ee8511b299e
parent  2596e0fae094be9354b29ddb17e6326a18012e8c (diff) 

x86: add code to dump the (kernel) page tables for visual inspection by kernel developers 

This patch adds code to the kernel to have an (optional)
/proc/kernel_page_tables debug file that basically dumps the kernel
pagetables; this allows us kernel developers to verify that nothing
fishy is going on and that the various mappings are set up correctly.
This was quite useful in finding various change_page_attr() bugs, and
is very likely to be useful in the future as well. 

Signed-off-by:Arjan van de Ven <arjan@linux.intel.com> 
Cc: mingo@elte.hu 
Cc: tglx@tglx.de 
Cc: hpa@zytor.com 
Signed-off-by: Ingo Molnar <mingo@elte.hu> 
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

添加的功能由新的配置选项 (X86_PTDUMP) 启用。

关于Linux - 识别在物理内存中拥有特定地址的进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/583517/

相关文章:

asp.net - 使用asp.net从windows服务器连接到Red hat linux上的oracle 11g

scala - 在 build.sbt 中,父项目中的依赖项未反射(reflect)在子模块中

linux - 如何读取arm linux中的内核镜像?

c - __pa 返回超出范围的物理地址

linux - QEMU 调试::警告:TCG 不支持请求的功能:CPUID.01H:ECX

linux - 使得无法在文件夹内创建新文件

linux - 如何通过 rpm 复制 yum 命令?

c# - 无法使用 Prism 从回调方法内部导航

android - 如何从 Android 中的另一个模块获取 BuildConfig.VERSION_NAME?

c++ - 如何使用 GDB 捕获除一种异常类型之外的所有异常类型?