inactive_list_is_low

 

/*

 * The inactive anon list should be smallenough that the VM never has

 * to do too much work.

 *

 * The inactive file list should be smallenough to leave most memory

 * to the established workingset on thescan-resistant active list,

 * but large enough to avoid thrashing theaggregate readahead window.

 *

 * Both inactive lists should also be largeenough that each inactive

 * page has a chance to be referenced againbefore it is reclaimed.

 *

 * The inactive_ratio is the target ratio ofACTIVE to INACTIVE pages

 * on this LRU, maintained by the pageout code.A zone->inactive_ratio

 * of 3 means 3:1 or 25% of the pages are kepton the inactive list.

 *

 * total    target    max

 * memory   ratio     inactive

 * -------------------------------------

 *  10MB       1         5MB

 * 100MB       1        50MB

 *   1GB       3       250MB

 *  10GB      10       0.9GB

 * 100GB      31         3GB

 *   1TB     101        10GB

 *  10TB     320        32GB

 */

static bool c(struct lruvec *lruvec, bool file)

{

       unsigned long inactive_ratio;

       unsigned long inactive;

       unsigned long active;

       unsigned long gb;

 

       /*

        *If we don't have swap space, anonymous page deactivation

        *is pointless.

        */

       if (!file && !total_swap_pages)

              return false;

 

       inactive = lruvec_lru_size(lruvec, file * LRU_FILE);

       active =lruvec_lru_size(lruvec, file * LRU_FILE + LRU_ACTIVE);

 

       gb = (inactive + active) >> (30 -PAGE_SHIFT);

       if (gb)

              inactive_ratio = int_sqrt(10 *gb);

       else

              inactive_ratio = 1;

 

       return inactive * inactive_ratio < active;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值