aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2012-03-21 19:34:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 20:54:59 -0400
commit05af2e104a0c282dcd9303431e1360750ba76de6 (patch)
treecdd5876f2d17b26cc3ded7ef85d04d0e853e9b7e /mm/memory.c
parent90481622d75715bfcb68501280a917dbfe516029 (diff)
mm, counters: remove task argument to sync_mm_rss() and __sync_task_rss_stat()
sync_mm_rss() can only be used for current to avoid race conditions in iterating and clearing its per-task counters. Remove the task argument for it and its helper function, __sync_task_rss_stat(), to avoid thinking it can be used safely for anything other than current. Signed-off-by: David Rientjes <rientjes@google.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/mm/memory.c b/mm/memory.c
index a5de734e14a7..2d27239ce4dd 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -125,17 +125,17 @@ core_initcall(init_zero_pfn);
125 125
126#if defined(SPLIT_RSS_COUNTING) 126#if defined(SPLIT_RSS_COUNTING)
127 127
128static void __sync_task_rss_stat(struct task_struct *task, struct mm_struct *mm) 128static void __sync_task_rss_stat(struct mm_struct *mm)
129{ 129{
130 int i; 130 int i;
131 131
132 for (i = 0; i < NR_MM_COUNTERS; i++) { 132 for (i = 0; i < NR_MM_COUNTERS; i++) {
133 if (task->rss_stat.count[i]) { 133 if (current->rss_stat.count[i]) {
134 add_mm_counter(mm, i, task->rss_stat.count[i]); 134 add_mm_counter(mm, i, current->rss_stat.count[i]);
135 task->rss_stat.count[i] = 0; 135 current->rss_stat.count[i] = 0;
136 } 136 }
137 } 137 }
138 task->rss_stat.events = 0; 138 current->rss_stat.events = 0;
139} 139}
140 140
141static void add_mm_counter_fast(struct mm_struct *mm, int member, int val) 141static void add_mm_counter_fast(struct mm_struct *mm, int member, int val)
@@ -157,12 +157,12 @@ static void check_sync_rss_stat(struct task_struct *task)
157 if (unlikely(task != current)) 157 if (unlikely(task != current))
158 return; 158 return;
159 if (unlikely(task->rss_stat.events++ > TASK_RSS_EVENTS_THRESH)) 159 if (unlikely(task->rss_stat.events++ > TASK_RSS_EVENTS_THRESH))
160 __sync_task_rss_stat(task, task->mm); 160 __sync_task_rss_stat(task->mm);
161} 161}
162 162
163void sync_mm_rss(struct task_struct *task, struct mm_struct *mm) 163void sync_mm_rss(struct mm_struct *mm)
164{ 164{
165 __sync_task_rss_stat(task, mm); 165 __sync_task_rss_stat(mm);
166} 166}
167#else /* SPLIT_RSS_COUNTING */ 167#else /* SPLIT_RSS_COUNTING */
168 168
@@ -643,7 +643,7 @@ static inline void add_mm_rss_vec(struct mm_struct *mm, int *rss)
643 int i; 643 int i;
644 644
645 if (current->mm == mm) 645 if (current->mm == mm)
646 sync_mm_rss(current, mm); 646 sync_mm_rss(mm);
647 for (i = 0; i < NR_MM_COUNTERS; i++) 647 for (i = 0; i < NR_MM_COUNTERS; i++)
648 if (rss[i]) 648 if (rss[i])
649 add_mm_counter(mm, i, rss[i]); 649 add_mm_counter(mm, i, rss[i]);