Andrew Morton | 2 Dec 02:30

Re: [PATCH 02/12] mm: supporting variables and functions for balanced zone aging

Wu Fengguang <wfg <at> mail.ustc.edu.cn> wrote:
>
>    850         sc->nr_to_reclaim = sc->swap_cluster_max;
>      851         
>      852         while (nr_active || nr_inactive) {
>                          //...
>      860                 if (nr_inactive) {
>      861                         sc->nr_to_scan = min(nr_inactive,
>      862                                         (unsigned long)sc->swap_cluster_max);
>      863                         nr_inactive -= sc->nr_to_scan;
>      864                         shrink_cache(zone, sc);
>      865                         if (sc->nr_to_reclaim <= 0)
>      866                                 break;
>      867                 }
>      868         }
> 
>  Line 843 is the core of the scan balancing logic:
> 
>  priority                12      11      10
> 
>  On each call nr_scan_inactive is increased by:
>  DMA(2k pages)           +1      +2      +3
>  Normal(64k pages)      +17      +33     +65 
> 
>  Round it up to SWAP_CLUSTER_MAX=32, we get (scan batches/accumulate rounds):
>  DMA                     1/32    1/16    2/11
>  Normal                  2/2     2/1     3/1
>  DMA:Normal ratio        1:32    1:32    2:33
> 
>  This keeps the scan rate roughly balanced(i.e. 1:32) in low vm pressure.
> 
>  But lines 865-866 together with line 846 make most shrink_zone() invocations
>  only run one batch of scan. The numbers become:

True.  Need to go into a huddle with the changelogs, but I have a feeling
that lines 865 and 866 aren't very important.  What happens if we remove
them?

Gmane