当前位置:网站首页>匿名页的反向映射
匿名页的反向映射
2022-06-28 08:05:00 【HZero.chen】

反向映射的建立过程
当通过fork创建子进程的时候,在这个过程中会建立反向映射的基础结构,具体在
kernel_clone -》 copy_mm -》 dup_mm -》 dup_mmap中:
- dup_mmap中会将父进程中的每一个vma 复制一份给子进程,此处只是举例说明复制一个vma的情况,如上图中子进程的vma
- anon_vma_clone中创建子进程的avc01,它同时与父进程的av0和子进程的vma建立关联,即加入子进程的vma链表,同时连入父进程av0的红黑树,它是作为子进程的一个代表加入到父进程av0的红黑树,将来父进程查找反向映射时,将遍历这颗红黑树,进而获得vma,而子进程进行反向映射时,仅仅遍历自己av的红黑树即可,这样提升了效率;
- 通过anon_vma_alloc为子进程分配自己的av1,它与父进程的av0形成父子关系;
- 通过anon_vma_chain_alloc为子进程分配自己的avc1;
- 通过anon_vma_chain_link建立子进程av1, avc1, vma的关联
注:如上av为strucdt anon_vma, avc为anon_vma_chain
反向映射的查找过程
- 通过page的mapping字段找到av;
- 遍历av的红黑树,找到所有的avc;
- 通过avc找到对应的vma,并通过vma找到vma_start,及vm_mm进而找到pgd;
- 通过page->index和vma_start得到虚拟页的起始地址;
- 通过虚拟页的起始地址和pgd找到pte
参考文档
《Linux内核深度解析》
《深入理解Linux内核反向映射机制》
边栏推荐
- Eslint 语法监测关闭
- Install haproxy
- Uninstall and reinstall the latest version of MySQL database. The test is valid
- HJ string sort
- Ambari (VII) --- ambari integrated hue4.2 document (valid for personal test)
- Redis uses sentinel master-slave switching. What should the program do?
- Airflow2 configuration windows azure SSO details based on oauth2 protocol
- Cloud native: cloud computing technology is upgraded again to open an era of comprehensive cloud development
- sql主從複制搭建
- sql主从复制搭建
猜你喜欢

Sentinel mechanism of redis cluster

Section 5: zynq interrupt

Three step problem of leetcode

Image translation /transformer:ittr: unpaired image to image translation with transformers

HJ质数因子
![[JS] - [DFS, BFS application] - learning notes](/img/77/6f8d4ebe1d0b3ba036aea9358de793.png)
[JS] - [DFS, BFS application] - learning notes

NLP sequence can completely simulate human brain intelligence

Introduction to Devops Basics

Porting ucosiii to stm32f429

ZYNQ_ IIC read / write m24m01 record board status
随机推荐
Conversion between HJ integer and IP address
Cloud native: cloud computing technology is upgraded again to open an era of comprehensive cloud development
Buffer pool in MySQL
Configuring MySQL multi instance master-slave synchronization for Linux
Airflow2.1.1 summary of the pits stepped on in actual combat!!
【js】-【DFS、BFS应用】-学习笔记
ZYNQ_ IIC read / write m24m01 record board status
MySQL implements transaction persistence using redo logs
软件测试与质量期末复习
Today's notes 22/1/7
Leetcode learning records
Soft test -- software designer -- database design of afternoon questions
HJ score ranking
GPIO configuration of SOC
Installing redis on Linux
Redis master-slave structure and application scenarios
三角变换公式
SQL master-slave replication setup
【js】-【节流、防抖函数】
Generation and verification of JWT token