免费注册 查看新帖 |

Chinaunix

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

页属性初始化时全为MIGRATE_MOVABLE?? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-03 15:09 |只看该作者 |倒序浏览
本帖最后由 xinghun_4 于 2011-12-03 15:14 编辑

深入linux架构165页书上说,memap_init_zone函数将所有页最初都标记为可移动的,但是从代码中,我觉得一开始并没用这样设置呀!!!!
  1. void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
  2.                 unsigned long start_pfn, enum memmap_context context)
  3. {
  4.         struct page *page;
  5.         unsigned long end_pfn = start_pfn + size;
  6.         unsigned long pfn;

  7.         for (pfn = start_pfn; pfn < end_pfn; pfn++) {
  8.                 /*
  9.                  * There can be holes in boot-time mem_map[]s
  10.                  * handed to this function.  They do not
  11.                  * exist on hotplugged memory.
  12.                  */
  13.                 if (context == MEMMAP_EARLY) {
  14.                         if (!early_pfn_valid(pfn))
  15.                                 continue;
  16.                         if (!early_pfn_in_nid(pfn, nid))
  17.                                 continue;
  18.                 }
  19.                 page = pfn_to_page(pfn);
  20.                 set_page_links(page, zone, nid, pfn);
  21.                 init_page_count(page);
  22.                 reset_page_mapcount(page);
  23.                 SetPageReserved(page); /*???????????????????????*/
  24.                          /*
  25.                  * Mark the block movable so that blocks are reserved for
  26.                  * movable at startup. This will force kernel allocations
  27.                  * to reserve their blocks rather than leaking throughout
  28.                  * the address space during boot when many long-lived
  29.                  * kernel allocations are made. Later some blocks near
  30.                  * the start are marked MIGRATE_RESERVE by
  31.                  * setup_zone_migrate_reserve()
  32.                  */
  33.                 if ((pfn & (pageblock_nr_pages-1)))/*???????????????????????????*/
  34.                         set_pageblock_migratetype(page, MIGRATE_MOVABLE);
复制代码
从上面问号的地方可以看出,我倒觉得一开始,所有页都标记为了reserved的了,是吗?求解释?求牛人指教!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP