aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2008-02-07 03:14:34 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:22 -0500
commit6c48a1d040a9a9eaa4acdd7d4cb3885e04bf8413 (patch)
tree2fcfb405b5664028d337a8a185c696c9c1f23e64 /mm/memcontrol.c
parent5932f3671bb2dd873c5ac443cbf5dc2cd167ae94 (diff)
per-zone and reclaim enhancements for memory controller: remember reclaim priority in memory cgroup
Functions to remember reclaim priority per cgroup (as zone->prev_priority) [akpm@linux-foundation.org: build fixes] [akpm@linux-foundation.org: more build fixes] Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Balbir Singh <balbir@linux.vnet.ibm.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>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 78a928d90267..f8a6a39c440d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -132,6 +132,7 @@ struct mem_cgroup {
132 */ 132 */
133 spinlock_t lru_lock; 133 spinlock_t lru_lock;
134 unsigned long control_type; /* control RSS or RSS+Pagecache */ 134 unsigned long control_type; /* control RSS or RSS+Pagecache */
135 int prev_priority; /* for recording reclaim priority */
135 /* 136 /*
136 * statistics. 137 * statistics.
137 */ 138 */
@@ -451,6 +452,25 @@ long mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem)
451 return (long) (active / (inactive + 1)); 452 return (long) (active / (inactive + 1));
452} 453}
453 454
455/*
456 * prev_priority control...this will be used in memory reclaim path.
457 */
458int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem)
459{
460 return mem->prev_priority;
461}
462
463void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem, int priority)
464{
465 if (priority < mem->prev_priority)
466 mem->prev_priority = priority;
467}
468
469void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, int priority)
470{
471 mem->prev_priority = priority;
472}
473
454unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 474unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
455 struct list_head *dst, 475 struct list_head *dst,
456 unsigned long *scanned, int order, 476 unsigned long *scanned, int order,