From 6c48a1d040a9a9eaa4acdd7d4cb3885e04bf8413 Mon Sep 17 00:00:00 2001 From: KAMEZAWA Hiroyuki Date: Thu, 7 Feb 2008 00:14:34 -0800 Subject: 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 Cc: "Eric W. Biederman" Cc: Balbir Singh Cc: David Rientjes Cc: Herbert Poetzl Cc: Kirill Korotaev Cc: Nick Piggin Cc: Paul Menage Cc: Pavel Emelianov Cc: Peter Zijlstra Cc: Vaidyanathan Srinivasan Cc: Rik van Riel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/memcontrol.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mm') diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 78a928d9026..f8a6a39c440 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -132,6 +132,7 @@ struct mem_cgroup { */ spinlock_t lru_lock; unsigned long control_type; /* control RSS or RSS+Pagecache */ + int prev_priority; /* for recording reclaim priority */ /* * statistics. */ @@ -451,6 +452,25 @@ long mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem) return (long) (active / (inactive + 1)); } +/* + * prev_priority control...this will be used in memory reclaim path. + */ +int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem) +{ + return mem->prev_priority; +} + +void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem, int priority) +{ + if (priority < mem->prev_priority) + mem->prev_priority = priority; +} + +void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, int priority) +{ + mem->prev_priority = priority; +} + unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, struct list_head *dst, unsigned long *scanned, int order, -- cgit v1.2.3