Linux 3.2.82
[pandora-kernel.git] / mm / vmscan.c
index 48febd7..ab98dc6 100644 (file)
@@ -1977,10 +1977,10 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
         * proportional to the fraction of recently scanned pages on
         * each list that were recently referenced and in active use.
         */
-       ap = (anon_prio + 1) * (reclaim_stat->recent_scanned[0] + 1);
+       ap = anon_prio * (reclaim_stat->recent_scanned[0] + 1);
        ap /= reclaim_stat->recent_rotated[0] + 1;
 
-       fp = (file_prio + 1) * (reclaim_stat->recent_scanned[1] + 1);
+       fp = file_prio * (reclaim_stat->recent_scanned[1] + 1);
        fp /= reclaim_stat->recent_rotated[1] + 1;
        spin_unlock_irq(&zone->lru_lock);
 
@@ -1993,7 +1993,7 @@ out:
                unsigned long scan;
 
                scan = zone_nr_lru_pages(zone, sc, l);
-               if (priority || noswap) {
+               if (priority || noswap || !vmscan_swappiness(sc)) {
                        scan >>= priority;
                        if (!scan && force_scan)
                                scan = SWAP_CLUSTER_MAX;
@@ -3015,6 +3015,11 @@ static int kswapd(void *p)
                                                &balanced_classzone_idx);
                }
        }
+
+       tsk->flags &= ~(PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD);
+       current->reclaim_state = NULL;
+       lockdep_clear_current_reclaim_state();
+
        return 0;
 }