- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
作为 Traversing all the physical pages of a process 答案的扩展和数据在这里http://www.makelinux.net/ldd3/chp-15-sect-1 ,我有一个小问题。在第一个答案中建议遍历进程的物理页面,
struct vm_area_struct *vma = 0;
unsigned long vpage;
if (task->mm && task->mm->mmap)
for (vma = task->mm->mmap; vma; vma = vma->vm_next)
for (vpage = vma->vm_start; vpage < vma->vm_end; vpage += PAGE_SIZE)
unsigned long phys = virt2phys(task->mm, vpage);
并引用标题“15.1.6.虚拟内存区域”下的第二个链接中给出的示例,即
# cat /proc/1/maps look at init
08048000-0804e000 r-xp 00000000 03:01 64652 /sbin/init text
0804e000-0804f000 rw-p 00006000 03:01 64652 /sbin/init data
0804f000-08053000 rwxp 00000000 00:00 0 zero-mapped BSS
40000000-40015000 r-xp 00000000 03:01 96278 /lib/ld-2.3.2.so text
40015000-40016000 rw-p 00014000 03:01 96278 /lib/ld-2.3.2.so data
现在我的问题是,当我遍历时,第一个区域的 vm_start
和 vm_end
的值将是 08048000
和 0804e000
,或者是 08048000
和 08053000
(一 block 连续的内存)。我可能应该编写一个程序并自己尝试一下,但我正在将这些数据用于另一个项目,如果有人可以帮助理解这一点,那将非常有帮助。我基本上想知道,如果
08048000-0804e000 r-xp 00000000 03:01 64652 /sbin/init text
0804e000-0804f000 rw-p 00006000 03:01 64652 /sbin/init data
0804f000-08053000 rwxp 00000000 00:00 0 zero-mapped BSS
是属于进程的一个“模块”,它是否有一个或多个vm_area_struct
数据结构。
谢谢。
最佳答案
每个 map 部分都有一个单独的vm_area_struct
。如果您查看 fs/proc/task_mmu.c
中的代码、函数 m_start()
和 m_next
,您会看到以下行maps
伪文件中的内容是通过迭代遍历进程 vma
列表来创建的。另外,请注意 struct vm_area_struct
声明的注释:
/*
* This struct defines a memory VMM memory area. There is one of these
* per VM-area/task. A VM area is any part of the process virtual memory
* space that has a special rule for the page-fault handlers (ie a shared
* library, the executable area etc).
*/
显然,文本、数据和 BSS 部分具有不同的页错误处理规则:文本根本无法写入。数据在首次访问时读取,然后在写入时复制。 BSS 首次访问归零。
关于c - 遍历进程的 `vm_area_struct`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30604506/
作为 Traversing all the physical pages of a process 答案的扩展和数据在这里http://www.makelinux.net/ldd3/chp-15-se
由于我只有第一版《Understanding the Linux Kernel》这本书,我看了一些Linux 2.2.14的源代码,已经很老了。 从源代码来看,我认为属于进程通过 open() 系统调
我正在使用 ARM 上的内核 3.18。我正在从正在为其编写驱动程序的相机读取数据。我使用以下设置内存: cpu_handle = dma_alloc_coherent(NULL, dma_size,
我正在阅读 Linux 设备驱动程序的内存管理一章,我遇到了 vm_area_struct 。该结构有一个偏移量字段,即 unsigned long vm_pgoff 。 我检查了该成员的评论为 /*
内核模块代码: static int __init module(void) { struct pid *current_pid; struct task_struct *curren
基本上,我需要识别使用页面的进程或任务,并相应地做出一些关于是否允许页面换出的决定。因为内核 AFAIK 中的交换模块主要处理 struct page,所以我想知道是否缺少一些现有的技巧。来自 inc
这是学校的一项作业,我需要使用系统调用来确定系统上进程的大小。我的代码如下: ... struct task_struct *p; struct vm_area_struct *v; struct m
在mm_struct中,有一些字段指示数据区域的范围:start_data、end_data。并且在数据区域的vm_area_struct中还有指示该区域范围的字段:vm_start、vm_end。
据我了解Linux内核中的内存管理,每个进程中都有一个负责地址空间的mm_struct结构。一个重要的内存区域是堆栈。这应该由 vm_area_struct 内存区域标识,mm_struct 本身有一
我是一名优秀的程序员,十分优秀!