Chinese translated version of Documentation/vm/soft-dirty
If you have any comment or update to the content, please contact the
original document maintainer directly. However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help. Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.
Chinese maintainer: 799942107@qq.com
---------------------------------------------------------------------
Documentation/Documentation/vm/soft-dirty的中文翻译
如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。
中文版维护者: 黄佳露 799942107@qq.com
中文版翻译者: 黄佳露 799942107@qq.com
中文版校译者: 潘丽卡 774945605@qq.com
以下为正文
---------------------------------------------------------------------
SOFT-DIRTY PTEs
软脏 PTEs
The soft-dirty is a bit on a PTE which helps to track which pages a task
writes to. In order to do this tracking one should
软脏在PTE上是一个位,有助于跟踪找到哪个页面任务写入的。有必要有一
个软脏去做跟踪。
1. Clear soft-dirty bits from the task's PTEs.
This is done by writing "4" into the /proc/PID/clear_refs file of the
task in question.
2. Wait some time.
3. Read soft-dirty bits from the PTEs.
This is done by reading from the /proc/PID/pagemap. The bit 55 of the
64-bit qword is the soft-dirty one. If set, the respective PTE was
written to since step 1.
1.从任务的PTES明确软脏位。
2.等待一些时间。
3.从PTES读软脏位。
这是通过从/proc/PID/pagemap阅读得到的。64位中的第55个位qword是软脏中的一个。
如果设置,各自的PTE从步骤1开始写入。
Internally, to do this tracking, the writable bit is cleared from PTEs
when the soft-dirty bit is cleared. So, after this, when the task tries to
modify a page at some virtual address the #PF occurs and the kernel sets
the soft-dirty bit on the respective PTE.
在内部,做这个跟踪是,当软脏位被清除时,可写位也从PTEs中被清除。所以,在这之后,
当任务尝试在一些虚拟地址上修改一个页面时,#PF发送并且内核在各自PTE上设置软脏位。
Note, that although all the task's address space is marked as r/o after the
soft-dirty bits clear, the #PF-s that occur after that are processed fast.
This is so, since the pages are still mapped to physical memory, and thus all
the kernel does is finds this fact out and puts both writable and soft-dirty
bits on the PTE.
注意,尽管在软脏位被清除后,所有的任务的地址空间都被标记位r/o,#PF-s的随之发生
会被快速处理掉。因为页面仍然映射到物理内存,因此所有内核都发现了这一事实,并且
把可写位和软脏位都放到PTE上。
While in most cases tracking memory changes by #PF-s is more than enough
there is still a scenario when we can lose soft dirty bits -- a task
unmaps a previously mapped memory region and then maps a new one at exactly
the same place. When unmap is called, the kernel internally clears PTE values
including soft dirty bits. To notify user space application about such
memory region renewal the kernel always marks new memory regions (and
expanded regions) as soft dirty.
虽然在大多数情况下用#PE-s跟踪内存的变化是绰绰有余的,但还是有特殊情况,那就是
当我们失去软脏位的时候--任务释放一个先前映射内存区域,然后在相同的地方绘制一个
新的。当释放被响应时,内核内部清理PTE的值包括软脏位。通知用户空间应用程序,这些
内存区域更新内核一直标志着新的内存区域(和扩大区域)作为软脏
This feature is actively used by the checkpoint-restore project. You
can find more details about it on http://criu.org
这个特性被积极地用于检查点恢复项目。你可以从http://criu.org找到更多关于它的细节
-- Pavel Emelyanov, Apr 9, 2013
If you have any comment or update to the content, please contact the original document maintainer directly. However, if you have a problem communicating in English you can also ask the Chinese maintainer for help. Contact the Chinese maintainer if this translation is outdated or if there is a problem with the translation.
Chinese maintainer: 799942107@qq.com --------------------------------------------------------------------- Documentation/Documentation/vm/soft-dirty的中文翻译
如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 译存在问题,请联系中文版维护者。
中文版维护者: 黄佳露 799942107@qq.com 中文版翻译者: 黄佳露 799942107@qq.com 中文版校译者: 潘丽卡 774945605@qq.com
以下为正文 --------------------------------------------------------------------- SOFT-DIRTY PTEs 软脏 PTEs The soft-dirty is a bit on a PTE which helps to track which pages a task writes to. In order to do this tracking one should
软脏在PTE上是一个位,有助于跟踪找到哪个页面任务写入的。有必要有一 个软脏去做跟踪。
1. Clear soft-dirty bits from the task's PTEs.
This is done by writing "4" into the /proc/PID/clear_refs file of the task in question.
2. Wait some time.
3. Read soft-dirty bits from the PTEs.
This is done by reading from the /proc/PID/pagemap. The bit 55 of the 64-bit qword is the soft-dirty one. If set, the respective PTE was written to since step 1.
1.从任务的PTES明确软脏位。 2.等待一些时间。 3.从PTES读软脏位。 这是通过从/proc/PID/pagemap阅读得到的。64位中的第55个位qword是软脏中的一个。 如果设置,各自的PTE从步骤1开始写入。 Internally, to do this tracking, the writable bit is cleared from PTEs when the soft-dirty bit is cleared. So, after this, when the task tries to modify a page at some virtual address the #PF occurs and the kernel sets the soft-dirty bit on the respective PTE.
在内部,做这个跟踪是,当软脏位被清除时,可写位也从PTEs中被清除。所以,在这之后, 当任务尝试在一些虚拟地址上修改一个页面时,#PF发送并且内核在各自PTE上设置软脏位。
Note, that although all the task's address space is marked as r/o after the soft-dirty bits clear, the #PF-s that occur after that are processed fast. This is so, since the pages are still mapped to physical memory, and thus all the kernel does is finds this fact out and puts both writable and soft-dirty bits on the PTE.
注意,尽管在软脏位被清除后,所有的任务的地址空间都被标记位r/o,#PF-s的随之发生 会被快速处理掉。因为页面仍然映射到物理内存,因此所有内核都发现了这一事实,并且 把可写位和软脏位都放到PTE上。
While in most cases tracking memory changes by #PF-s is more than enough there is still a scenario when we can lose soft dirty bits -- a task unmaps a previously mapped memory region and then maps a new one at exactly the same place. When unmap is called, the kernel internally clears PTE values including soft dirty bits. To notify user space application about such memory region renewal the kernel always marks new memory regions (and expanded regions) as soft dirty.
虽然在大多数情况下用#PE-s跟踪内存的变化是绰绰有余的,但还是有特殊情况,那就是 当我们失去软脏位的时候--任务释放一个先前映射内存区域,然后在相同的地方绘制一个 新的。当释放被响应时,内核内部清理PTE的值包括软脏位。通知用户空间应用程序,这些 内存区域更新内核一直标志着新的内存区域(和扩大区域)作为软脏
This feature is actively used by the checkpoint-restore project. You can find more details about it on http://criu.org
这个特性被积极地用于检查点恢复项目。你可以从http://criu.org找到更多关于它的细节
-- Pavel Emelyanov, Apr 9, 2013