免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 907 | 回复: 0
打印 上一主题 下一主题

[内核入门] 延长filemap_sync函数的执行时间 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-10-29 22:02 |只看该作者 |倒序浏览
本帖最后由 willcream 于 2015-10-29 22:03 编辑

在msync系统调用里,会调用到filemap_sync。
filemap_sync scans the Page Table entries corresponding to the linear address intervals included in the memory region. For each page found, it invokes flush_tlb_page( ) to flush the corresponding translation lookaside buffers, and marks the page as dirty.
  1. int filemap_sync(struct vm_area_struct * vma, unsigned long address,
  2.         size_t size, unsigned int flags)
  3. {
  4.         pgd_t * dir;
  5.         unsigned long end = address + size;
  6.         int error = 0;


  7.         spin_lock(&vma->vm_mm->page_table_lock);

  8.         dir = pgd_offset(vma->vm_mm, address);
  9.         flush_cache_range(vma->vm_mm, end - size, end);
  10.         if (address >= end)
  11.                 BUG();
  12.         do {
  13.                 error |= filemap_sync_pmd_range(dir, address, end - address, vma, flags);
  14.                 address = (address + PGDIR_SIZE) & PGDIR_MASK;
  15.                 dir++;
  16.         } while (address && (address < end));
  17.         flush_tlb_range(vma->vm_mm, end - size, end);

  18.         spin_unlock(&vma->vm_mm->page_table_lock);

  19.         return error;
  20. }
复制代码
我现在想在用户空间代码中实现让这个filemap_sync函数执行得越久越好,请问有什么方法吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP