lkml.org 
[lkml]   [2009]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] vmscan: aligned scan batching
    >  - pass nr_to_scan into isolate_pages() directly instead
    > using SWAP_CLUSTER_MAX

    This patch will make sure nr_to_scan==SWAP_CLUSTER_MAX :)

    Thanks,
    Fengguang
    ---
    vmscan: aligned scan batching

    Make sure ->isolate_pages() always scans in unit of SWAP_CLUSTER_MAX.

    CC: Rik van Riel <riel@redhat.com>
    CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
    ---
    mm/vmscan.c | 20 ++++++--------------
    1 file changed, 6 insertions(+), 14 deletions(-)

    --- linux-mm.orig/mm/vmscan.c 2009-12-06 13:13:28.000000000 +0800
    +++ linux-mm/mm/vmscan.c 2009-12-06 13:31:21.000000000 +0800
    @@ -1572,15 +1572,11 @@ static void get_scan_ratio(struct zone *
    static unsigned long nr_scan_try_batch(unsigned long nr_to_scan,
    unsigned long *nr_saved_scan)
    {
    - unsigned long nr;
    + unsigned long nr = *nr_saved_scan + nr_to_scan;
    + unsigned long rem = nr & (SWAP_CLUSTER_MAX - 1);

    - *nr_saved_scan += nr_to_scan;
    - nr = *nr_saved_scan;
    -
    - if (nr >= SWAP_CLUSTER_MAX)
    - *nr_saved_scan = 0;
    - else
    - nr = 0;
    + *nr_saved_scan = rem;
    + nr -= rem;

    return nr;
    }
    @@ -1592,7 +1588,6 @@ static void shrink_zone(int priority, st
    struct scan_control *sc)
    {
    unsigned long nr[NR_LRU_LISTS];
    - unsigned long nr_to_scan;
    unsigned long percent[2]; /* anon @ 0; file @ 1 */
    enum lru_list l;
    unsigned long nr_reclaimed = sc->nr_reclaimed;
    @@ -1625,11 +1620,8 @@ static void shrink_zone(int priority, st
    nr[LRU_INACTIVE_FILE]) {
    for_each_evictable_lru(l) {
    if (nr[l]) {
    - nr_to_scan = min_t(unsigned long,
    - nr[l], SWAP_CLUSTER_MAX);
    - nr[l] -= nr_to_scan;
    -
    - nr_reclaimed += shrink_list(l, nr_to_scan,
    + nr[l] -= SWAP_CLUSTER_MAX;
    + nr_reclaimed += shrink_list(l, SWAP_CLUSTER_MAX,
    zone, sc, priority);
    }
    }

    \
     
     \ /
      Last update: 2009-12-06 06:43    [W:0.023 / U:31.124 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site