zoukankan      html  css  js  c++  java
  • how kswapd work & swap parameter & swap demo

    2.2.1 Zone Watermarks

    When available memory in the system is low, the pageout daemon kswapd is woken up to start freeing pages (see Chapter 10). If the pressure is high, the process will free up memory synchronously, sometimes referred to as the direct-reclaim path. The parameters affecting pageout behavior are similar to those used by FreeBSD [McK96] and Solaris [MM01].

    Each zone has three watermarks called pages_low, pages_min and pages_high, which help track how much pressure a zone is under. The relationship between them is illustrated in Figure 2.2. The number of pages for pages_min is calculated in the function free_area_init_core() during memory init and is based on a ratio to the size of the zone in pages. It is calculated initially as ZoneSizeInPages/128. The lowest value it will be is 20 pages (80K on a x86), and the highest possible value is 255 pages (1MiB on a x86).

    Figure 2.2. Zone Watermarks

     

    clip_image001

     

    涉及swap,有三个参数,page_min,page_max,pages_low,

    下文中简称(min,max,low)

     

    当可用页数 available pages)小于min,启动kswapd

     

    当可用页数               其小于low,依然可以分配,只不过只能是fgp_atomic类型。

    问题:图中,从minlow,页消耗率明显降低。但是小于low后,为何页消耗率会又增加?

    在书上的注释说:

     

    pages_min When pages_min is reached, the allocator will do the kswapd work in a synchronous fashion, sometimes referred to as the direct-reclaim path. Solaris does not have a real equivalent, but the closest is the desfree or minfree, which determine how often the pageout scanner is woken up.

    我看完注释,依然不解。

     

    当可用页数 恢复到max,此时kswap休眠。

    期间,从minlow,low high,前个区间回收页面的速率低,我认为前段区间有内存分配器的帮忙,后者只有kswapd工作。不知各位看法。

     

     

     

     

     

    At each watermark a different action is taken to address the memory shortage.

     

    pages_low When the pages_low number of free pages is reached, kswapd is woken up by the buddy allocator to start freeing pages. This is equivalent to when lotsfree is reached in Solaris and freemin in FreeBSD. The value is twice the value of pages_min by default.

     

    pages_min When pages_min is reached, the allocator will do the kswapd work in a synchronous fashion, sometimes referred to as the direct-reclaim path. Solaris does not have a real equivalent, but the closest is the desfree or minfree, which determine how often the pageout scanner is woken up.

     

    pages_high   After kswapd has been woken to start freeing pages, it will not consider the zone to be "balanced" when pages_high pages are free.

     

     After the watermark has been reached, kswapd will go back to sleep. In Solaris, this is called lotsfree, and, in BSD, it is called free_target. The default for pages_high is three times the value of pages_min.

     

     

    Whatever the pageout parameters are called in each operating system, the meaning is the same. It helps determine how hard the pageout daemon or processes work to free up pages.

  • 相关阅读:
    数据库字段说明查询
    MUI 微信支付代码
    数据库 批量删除表
    c# 微信开发 《内容回复或事件触发》
    C# 微信开发 《验证签名》
    SQL SERVER占用CPU过高排查和优化
    类属性验证简单说明
    地图纠偏
    区块链-6一个故事告诉你比特币的原理及运作机制
    区块链-5区块链技术入门,涉及哪些编程语言?
  • 原文地址:https://www.cnblogs.com/titer1/p/2433934.html
Copyright © 2011-2022 走看看