Page migration_page_migration 的记录-程序员宅基地

技术标签: linux驱动  

网址:https://www.kernel.org/doc/html/latest/vm/page_migration.html

Page migration allows moving the physical location of pages between nodes in a NUMA system while the process is running. This means that the virtual addresses that the process sees do not change. However, the system rearranges the physical location of those pages.

The main intent of page migration is to reduce the latency of memory accesses by moving pages near to the processor where the process accessing that memory is running.

How migrate_pages() works
migrate_pages() does several passes over its list of pages. A page is moved if all references to a page are removable at the time. The page has already been removed from the LRU via isolate_lru_page() and the refcount is increased so that the page cannot be freed while page migration occurs.
Steps:
1. Lock the page to be migrated.
2. Ensure that writeback is complete.
3. Lock the new page that we want to move to. It is locked so that accesses to this (not yet up-to-date) page immediately block while the move is in progress.
4. All the page table references to the page are converted to migration entries. This decreases the mapcount of a page. If the resulting mapcount is not zero then we do not migrate the page. All user space processes that attempt to access the page will now wait on the page lock or wait for the migration page table entry to be removed.
5. The i_pages lock is taken. This will cause all processes trying to access the page via the mapping to block on the spinlock.
6. The refcount of the page is examined and we back out if references remain. Otherwise, we know that we are the only one referencing this page.
7. The radix tree is checked and if it does not contain the pointer to this page then we back out because someone else modified the radix tree.
8. The new page is prepped with some settings from the old page so that accesses to the new page will discover a page with the correct settings.
9. The radix tree is changed to point to the new page.
10. The reference count of the old page is dropped because the address space reference is gone. A reference to the new page is established because the new page is referenced by the address space.
11. The i_pages lock is dropped. With that lookups in the mapping become possible again. Processes will move from spinning on the lock to sleeping on the locked new page.
12. The page contents are copied to the new page.
13. The remaining page flags are copied to the new page.
14. The old page flags are cleared to indicate that the page does not provide any information anymore.
15. Queued up writeback on the new page is triggered.
16. If migration entries were inserted into the page table, then replace them with real ptes. Doing so will enable access for user space processes not already waiting for the page lock.
17. The page locks are dropped from the old and new page. Processes waiting on the page lock will redo their page faults and will reach the new page.
18. The new page is moved to the LRU and can be scanned by the swapper, etc. again.
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/huifeidedabian/article/details/117231923

智能推荐

linux c 实现简易HTTP服务器_linux c http-程序员宅基地

文章浏览阅读8.6k次,点赞4次,收藏39次。需要用到的知识点:HTTP协议socket通信linux多线程server.c#include #include #include #include #include #include #include #incl_linux c http

服务器装系统进pe界面就死机了,进入PE后安装系统老是会卡住。是什么问题啊。...-程序员宅基地

文章浏览阅读8.7k次。满意答案WJC1986118WJ推荐于 2017.11.27【◆】【你好】【◆】.进入PE后安装系统老是会卡住.建议你重新下载原版镜像,格式化C盘,进行干净安装..还卡则需检测硬盘有无错误及坏道~可使用DiskGenius>检测和尝试修复硬盘坏道..★重要提示:修复硬盘坏磁道,会破坏坏磁道及其临近扇区的数据。请在硬盘坏道修复前,先做好数据备份,以减少不必要的数据损失!!!..★电脑安装(重装..._pe很卡

ffmpeg音视频处理流程核心技术_视频效果演示系统的核心技术-程序员宅基地

文章浏览阅读712次。视频播放器原理 什么是ffmpeg? ffmpeg 音视频编/解码 流程图 ffmpeg 常用 struct AVFormatContext AVStream AVCodecContext AVCodec AVPacket AVFrame ffmpeg 常用Api av_register_all() avformat_alloc_output_context2() avio_open()..._视频效果演示系统的核心技术

Java List集合多种情况处理方法_java list reduce-程序员宅基地

文章浏览阅读449次。Java List集合多种情况处理方法:List集合交集、并集、差集、去重、与数组互转、删除、排序等操作_java list reduce

【UML】软件需求说明书_uml需求文档访客管家-程序员宅基地

文章浏览阅读2.3k次,点赞77次,收藏80次。需求:指人对客观事务需要的表现,体现为愿望、意向和兴趣,因而成为行动的一种直接原因。软件需求(IEEE软件工程标准词汇表):(1)用户解决问题或达到目标所需的条件或能力。(2)系统或系统部件要满足合同、标准、规范或者其他正式规定文档所需具有条 件或能力。(3)对(1)或(2)中的一个条件或一种能力的一种文档化表述。用例:定义 1 用例是对一个活动者使用一个系统的一项功能时进行交互过程中的一个文字描述序列。_uml需求文档访客管家

linux笔记-根文件系统及文件管理命令详解_根文件系统文本登陆-程序员宅基地

文章浏览阅读574次。第三章、Linux根文件系统及文件管理命令详解02_03_Linux根文件系统详解文件系统:rootfs: 根文件系统 FHS:Filesystem Hierarchy Standard(文件系统目录标准)的缩写,多数Linux版本采用这种文件组织形式,类似于Windows操作系统中c盘的文件目录,FHS采用树形结构组织文件。FHS定_根文件系统文本登陆

随便推点

idea配置tomcat环境_idea的tomcat,连接不显示explore-程序员宅基地

文章浏览阅读788次。打开idea–>点击项目Edit Configurations添加tomcat添加项目 war exploded(选择右边+号进行添加)特别注意如果项目pom文件的build中配置了finalName,则Application context中需配置对应的名称_idea的tomcat,连接不显示explore

说说内核与计算机硬件结构-程序员宅基地

文章浏览阅读502次。1.内核诸如51/ARM/90/PIC/AVR.....有好多种的,何况内核从来不分类,因为每一家常都可以改内核,你应该问的是架构!!只有懂架构才能用什么片子都驾轻就熟. 我详细的说一下吧. HARVARD(哈佛)架构:ROM(程序空间)与RAM(数据空间)分开,便于程序与数据的同时访问,减少程序运行时访问的瓶颈,提高数据吞吐. PRINCETON(普林斯顿)架构:采用通用计算机广泛使用的..._dcache和微处理器的接口 整个系统的层次结构如图1所示

数据结构应用案例——栈结构用于8皇后问题的回溯求解-程序员宅基地

文章浏览阅读862次。【说明】本文来自由周世平老师主编的《C语言程序设计》教材。我作为参编人员执笔了第7、8章。“第8章 问题求解与算法”中“8.6.1 回溯法”以8皇后问题的求解为例,介绍了回溯法的解题过程。这个解决方案中用到了“栈”,引用至此,作为栈应用的例子。需要说明的是,教材面向程序设计初学者,并全文中并未提出过任何关于“栈”的描述。这样做,隐藏了术..._八皇后栈回溯代码实现数据结构

c语言scanf中的分隔符的作用,C语言中scanf与分隔符(空格回车Tab)-程序员宅基地

文章浏览阅读2.5k次,点赞3次,收藏12次。众所周知,C语言中的scanf函数的作用是从标准输入设备(通常是键盘)读取输入值,并存储到参数列表中指针所指向的内存单元。下面从几个方面说一下一些稍微细节的东西。下面的实验都在vc6.0中通过。1、scanf的返回值scanf通常返回的是成功赋值(从标准输入设备赋值到参数列表所指定的内存区域)的数据项数,如果出错或是遇到end of file(注意,如果想从键盘输入EOF,在windows的DOS..._不同类型输入要分隔符吗c语言

Canvas实现黑客帝国字符雨_canvas画字符雨-程序员宅基地

文章浏览阅读1k次。 利用Canvas的fillText(),隔一定时间在画布上作画<!DOCTYPE html><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> &_canvas画字符雨

微信公众号跳转微信小程序,自定义微信跳转标签_opentaglist-程序员宅基地

文章浏览阅读1.1k次。微信公众号跳转微信小程序,自定义微信跳转标签_opentaglist

推荐文章

热门文章

相关标签