在 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/