Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=91a45470f7ddc322073752e711a2e8dcbc339e6f
Commit:     91a45470f7ddc322073752e711a2e8dcbc339e6f
Parent:     df878fb04dea044378274d40d063279a9cb787fb
Author:     KAMEZAWA Hiroyuki <[EMAIL PROTECTED]>
AuthorDate: Thu Feb 7 00:14:29 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Feb 7 08:42:21 2008 -0800

    per-zone and reclaim enhancements for memory controller: add 
scan_global_lru macro
    
    This is used to detect which scan_control scans global lru or mem_cgroup 
lru.
    And compiled to be static value (1) when memory controller is not 
configured.
    This may make the meaning obvious.
    
    Acked-by: Balbir Singh <[EMAIL PROTECTED]>
    Signed-off-by: KAMEZAWA Hiroyuki <[EMAIL PROTECTED]>
    Cc: "Eric W. Biederman" <[EMAIL PROTECTED]>
    Cc: David Rientjes <[EMAIL PROTECTED]>
    Cc: Herbert Poetzl <[EMAIL PROTECTED]>
    Cc: Kirill Korotaev <[EMAIL PROTECTED]>
    Cc: Nick Piggin <[EMAIL PROTECTED]>
    Cc: Paul Menage <[EMAIL PROTECTED]>
    Cc: Pavel Emelianov <[EMAIL PROTECTED]>
    Cc: Peter Zijlstra <[EMAIL PROTECTED]>
    Cc: Vaidyanathan Srinivasan <[EMAIL PROTECTED]>
    Cc: Rik van Riel <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/vmscan.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 159e6c7..be4dfe8 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -126,6 +126,12 @@ long vm_total_pages;       /* The total number of pages 
which the VM controls */
 static LIST_HEAD(shrinker_list);
 static DECLARE_RWSEM(shrinker_rwsem);
 
+#ifdef CONFIG_CGROUP_MEM_CONT
+#define scan_global_lru(sc)    (!(sc)->mem_cgroup)
+#else
+#define scan_global_lru(sc)    (1)
+#endif
+
 /*
  * Add a shrinker callback to be called from the vm
  */
@@ -1280,11 +1286,12 @@ static unsigned long do_try_to_free_pages(struct zone 
**zones, gfp_t gfp_mask,
                 * Don't shrink slabs when reclaiming memory from
                 * over limit cgroups
                 */
-               if (sc->mem_cgroup == NULL)
+               if (scan_global_lru(sc)) {
                        shrink_slab(sc->nr_scanned, gfp_mask, lru_pages);
-               if (reclaim_state) {
-                       nr_reclaimed += reclaim_state->reclaimed_slab;
-                       reclaim_state->reclaimed_slab = 0;
+                       if (reclaim_state) {
+                               nr_reclaimed += reclaim_state->reclaimed_slab;
+                               reclaim_state->reclaimed_slab = 0;
+                       }
                }
                total_scanned += sc->nr_scanned;
                if (nr_reclaimed >= sc->swap_cluster_max) {
@@ -1311,7 +1318,7 @@ static unsigned long do_try_to_free_pages(struct zone 
**zones, gfp_t gfp_mask,
                        congestion_wait(WRITE, HZ/10);
        }
        /* top priority shrink_caches still had more to do? don't OOM, then */
-       if (!sc->all_unreclaimable && sc->mem_cgroup == NULL)
+       if (!sc->all_unreclaimable && scan_global_lru(sc))
                ret = 1;
 out:
        /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to