是否可以从用户空间中找到 mmap 页面的脏度? [英] Can the dirtiness of pages of a mmap be found from userspace?

查看:44
本文介绍了是否可以从用户空间中找到 mmap 页面的脏度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 linux 2.6.30+ 下可以从用户空间访问(非共享)mmap 页面的脏污吗?欢迎针对特定平台的黑客和混搭.

Can dirtiness of pages of a (non-shared) mmap be accessed from userspace under linux 2.6.30+? Platform-specific hacks and kludges welcome.

理想情况下,我正在寻找一组位,每页 (4kB?) 的 mmap'ed 区域,如果自该区域被 mmap'ed 以来已写入该页面,则设置这些位.

Ideally, I'm looking for an array of bits, one per page (4kB?) of the mmap'ed region, which are set if that page has been written to since the region was mmap'ed.

(我知道,执行写入的进程可以跟踪此信息 - 但如果内核无论如何这样做,这样做似乎很愚蠢.)

(I am aware, that the process doing the writing could keep track of this information - but it seems silly to do so if the kernel is doing it anyway.)

谢谢,

克里斯.

推荐答案

参见/proc/*/pagemap /proc/kpageflags 接口.首先告诉您地址的 PFN,第二个告诉您给定 PFN 的脏位.

See /proc/*/pagemap and /proc/kpageflags interfaces. First tells you PFN for an address, second tells you dirty bit given PFN.

参见 fs/proc/task_mmu.c、Documentation/vm/pagemap.txt、Documentation/vm/page-types.c.

See fs/proc/task_mmu.c , Documentation/vm/pagemap.txt, Documentation/vm/page-types.c .

这篇关于是否可以从用户空间中找到 mmap 页面的脏度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆