[PATCH] vmscan: emove obsolete checks from shrink_list() and fix unlikely in refill_i...
authorChristoph Lameter <clameter@engr.sgi.com>
Wed, 22 Mar 2006 08:08:45 +0000 (00:08 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 22 Mar 2006 15:54:02 +0000 (07:54 -0800)
As suggested by Marcelo:

1. The optimization introduced recently for not calling
   page_referenced() during zone reclaim makes two additional checks in
   shrink_list unnecessary.

2. The if (unlikely(sc->may_swap)) in refill_inactive_zone is optimized
   for the zone_reclaim case.  However, most peoples system only does swap.
   Undo that.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/vmscan.c

index 3914a94aa905be83a6a533faf9c9add7d6f48cc0..f713e9f6ac733c07f305e0fce93aa9e1f8f6b6b4 100644 (file)
@@ -460,12 +460,9 @@ static unsigned long shrink_page_list(struct list_head *page_list,
                 * Anonymous process memory has backing store?
                 * Try to allocate it some swap space here.
                 */
-               if (PageAnon(page) && !PageSwapCache(page)) {
-                       if (!sc->may_swap)
-                               goto keep_locked;
+               if (PageAnon(page) && !PageSwapCache(page))
                        if (!add_to_swap(page, GFP_ATOMIC))
                                goto activate_locked;
-               }
 #endif /* CONFIG_SWAP */
 
                mapping = page_mapping(page);
@@ -477,12 +474,6 @@ static unsigned long shrink_page_list(struct list_head *page_list,
                 * processes. Try to unmap it here.
                 */
                if (page_mapped(page) && mapping) {
-                       /*
-                        * No unmapping if we do not swap
-                        */
-                       if (!sc->may_swap)
-                               goto keep_locked;
-
                        switch (try_to_unmap(page, 0)) {
                        case SWAP_FAIL:
                                goto activate_locked;
@@ -1205,7 +1196,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
        struct pagevec pvec;
        int reclaim_mapped = 0;
 
-       if (unlikely(sc->may_swap)) {
+       if (sc->may_swap) {
                long mapped_ratio;
                long distress;
                long swap_tendency;