博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
pgdat_balanced
阅读量:4153 次
发布时间:2019-05-25

本文共 1580 字,大约阅读时间需要 5 分钟。

 

/*

 * pgdat_balanced() is used when checking if anode is balanced.

 *

 * For order-0, all zones must be balanced!

 *

 * For high-order allocations only zones thatmeet watermarks and are in a

 * zone allowed by the callers classzone_idxare added to balanced_pages. The

 * total of balanced pages must be at least 25%of the zones allowed by

 * classzone_idx for the node to be consideredbalanced. Forcing all zones to

 * be balanced for high orders can causeexcessive reclaim when there are

 * imbalanced zones.

 * The choice of 25% is due to

 *   o a16M DMA zone that is balanced will not balance a zone on any

 *    reasonable sized machine

 *   o Onall other machines, the top zone must be at least a reasonable

 *    percentage of the middle zones. For example, on 32-bit x86, highmem

 *    would need to be at least 256M for it to be balance a whole node.

 *    Similarly, on x86-64 the Normal zone would need to be at least 1G

 *     tobalance a node on its own. These seemed like reasonable ratios.

 */

static bool pgdat_balanced(pg_data_t *pgdat, int order, intclasszone_idx)

{

       unsigned long managed_pages = 0;

       unsigned long balanced_pages = 0;

       int i;

 

       /* Check the watermark levels */

       for(i = 0; i <= classzone_idx; i++) {

              struct zone *zone =pgdat->node_zones + i;

 

              if (!populated_zone(zone))

                     continue;

 

              managed_pages +=zone->managed_pages;

              if (!zone_reclaimable(zone)) {

                     balanced_pages +=zone->managed_pages;

                     continue;

              }

 

              if (zone_balanced(zone, order, false, 0, i))

                     balanced_pages +=zone->managed_pages;

              else if (!order)

                     return false;

       }

 

       if (order)

              return balanced_pages >= (managed_pages >> 2);

       else

              return true;

}

转载地址:http://exqti.baihongyu.com/

你可能感兴趣的文章
手绘VS码绘(一):静态图绘制(码绘使用P5.js)
查看>>
《达芬奇的人生密码》观后感
查看>>
基于“分形”编写的交互应用
查看>>
链睿和家乐福合作推出下一代零售业隐私保护技术
查看>>
Unifrax宣布新建SiFAB™生产线
查看>>
艾默生纪念谷轮™在空调和制冷领域的百年创新成就
查看>>
NEXO代币持有者获得20,428,359.89美元股息
查看>>
Piper Sandler为EverArc收购Perimeter Solutions提供咨询服务
查看>>
RMRK筹集600万美元,用于在Polkadot上建立先进的NFT系统标准
查看>>
JavaSE_day14 集合中的Map集合_键值映射关系
查看>>
异常 Java学习Day_15
查看>>
Mysql初始化的命令
查看>>
MySQL关键字的些许问题
查看>>
浅谈HTML
查看>>
css基础
查看>>
Servlet进阶和JSP基础
查看>>
servlet中的cookie和session
查看>>
过滤器及JSP九大隐式对象
查看>>
软件(项目)的分层
查看>>
【Python】学习笔记——-7.0、面向对象编程
查看>>