mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 05:02:31 +00:00
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 <balbir@linux.vnet.ibm.com> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: David Rientjes <rientjes@google.com> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: Kirill Korotaev <dev@sw.ru> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Paul Menage <menage@google.com> Cc: Pavel Emelianov <xemul@openvz.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
df878fb04d
commit
91a45470f7
17
mm/vmscan.c
17
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 LIST_HEAD(shrinker_list);
|
||||||
static DECLARE_RWSEM(shrinker_rwsem);
|
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
|
* 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
|
* Don't shrink slabs when reclaiming memory from
|
||||||
* over limit cgroups
|
* over limit cgroups
|
||||||
*/
|
*/
|
||||||
if (sc->mem_cgroup == NULL)
|
if (scan_global_lru(sc)) {
|
||||||
shrink_slab(sc->nr_scanned, gfp_mask, lru_pages);
|
shrink_slab(sc->nr_scanned, gfp_mask, lru_pages);
|
||||||
if (reclaim_state) {
|
if (reclaim_state) {
|
||||||
nr_reclaimed += reclaim_state->reclaimed_slab;
|
nr_reclaimed += reclaim_state->reclaimed_slab;
|
||||||
reclaim_state->reclaimed_slab = 0;
|
reclaim_state->reclaimed_slab = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
total_scanned += sc->nr_scanned;
|
total_scanned += sc->nr_scanned;
|
||||||
if (nr_reclaimed >= sc->swap_cluster_max) {
|
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);
|
congestion_wait(WRITE, HZ/10);
|
||||||
}
|
}
|
||||||
/* top priority shrink_caches still had more to do? don't OOM, then */
|
/* 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;
|
ret = 1;
|
||||||
out:
|
out:
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user