diff options
author | Matt Mackall <mpm@selenic.com> | 2008-02-05 01:29:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:16 -0500 |
commit | 4752c369789250eafcd7813e11c8fb689235b0d2 (patch) | |
tree | 24fda864f4962f18fd8e118271f1d8c4ec633024 /fs/proc/task_mmu.c | |
parent | b3ae5acbbb98d95c1300c8ced56d15f97d09c506 (diff) |
maps4: simplify interdependence of maps and smaps
This pulls the shared map display code out of show_map and puts it in
show_smap where it belongs.
Signed-off-by: Matt Mackall <mpm@selenic.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/task_mmu.c')
-rw-r--r-- | fs/proc/task_mmu.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 791b2d400be5..abc44f39f1d6 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -145,7 +145,7 @@ struct mem_size_stats | |||
145 | u64 pss; | 145 | u64 pss; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats *mss) | 148 | static int show_map(struct seq_file *m, void *v) |
149 | { | 149 | { |
150 | struct proc_maps_private *priv = m->private; | 150 | struct proc_maps_private *priv = m->private; |
151 | struct task_struct *task = priv->task; | 151 | struct task_struct *task = priv->task; |
@@ -205,35 +205,11 @@ static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats | |||
205 | } | 205 | } |
206 | seq_putc(m, '\n'); | 206 | seq_putc(m, '\n'); |
207 | 207 | ||
208 | if (mss) | ||
209 | seq_printf(m, | ||
210 | "Size: %8lu kB\n" | ||
211 | "Rss: %8lu kB\n" | ||
212 | "Pss: %8lu kB\n" | ||
213 | "Shared_Clean: %8lu kB\n" | ||
214 | "Shared_Dirty: %8lu kB\n" | ||
215 | "Private_Clean: %8lu kB\n" | ||
216 | "Private_Dirty: %8lu kB\n" | ||
217 | "Referenced: %8lu kB\n", | ||
218 | (vma->vm_end - vma->vm_start) >> 10, | ||
219 | mss->resident >> 10, | ||
220 | (unsigned long)(mss->pss >> (10 + PSS_SHIFT)), | ||
221 | mss->shared_clean >> 10, | ||
222 | mss->shared_dirty >> 10, | ||
223 | mss->private_clean >> 10, | ||
224 | mss->private_dirty >> 10, | ||
225 | mss->referenced >> 10); | ||
226 | |||
227 | if (m->count < m->size) /* vma is copied successfully */ | 208 | if (m->count < m->size) /* vma is copied successfully */ |
228 | m->version = (vma != get_gate_vma(task))? vma->vm_start: 0; | 209 | m->version = (vma != get_gate_vma(task))? vma->vm_start: 0; |
229 | return 0; | 210 | return 0; |
230 | } | 211 | } |
231 | 212 | ||
232 | static int show_map(struct seq_file *m, void *v) | ||
233 | { | ||
234 | return show_map_internal(m, v, NULL); | ||
235 | } | ||
236 | |||
237 | static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | 213 | static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, |
238 | void *private) | 214 | void *private) |
239 | { | 215 | { |
@@ -312,13 +288,37 @@ static int show_smap(struct seq_file *m, void *v) | |||
312 | { | 288 | { |
313 | struct vm_area_struct *vma = v; | 289 | struct vm_area_struct *vma = v; |
314 | struct mem_size_stats mss; | 290 | struct mem_size_stats mss; |
291 | int ret; | ||
315 | 292 | ||
316 | memset(&mss, 0, sizeof mss); | 293 | memset(&mss, 0, sizeof mss); |
317 | mss.vma = vma; | 294 | mss.vma = vma; |
318 | if (vma->vm_mm && !is_vm_hugetlb_page(vma)) | 295 | if (vma->vm_mm && !is_vm_hugetlb_page(vma)) |
319 | walk_page_range(vma->vm_mm, vma->vm_start, vma->vm_end, | 296 | walk_page_range(vma->vm_mm, vma->vm_start, vma->vm_end, |
320 | &smaps_walk, &mss); | 297 | &smaps_walk, &mss); |
321 | return show_map_internal(m, v, &mss); | 298 | |
299 | ret = show_map(m, v); | ||
300 | if (ret) | ||
301 | return ret; | ||
302 | |||
303 | seq_printf(m, | ||
304 | "Size: %8lu kB\n" | ||
305 | "Rss: %8lu kB\n" | ||
306 | "Pss: %8lu kB\n" | ||
307 | "Shared_Clean: %8lu kB\n" | ||
308 | "Shared_Dirty: %8lu kB\n" | ||
309 | "Private_Clean: %8lu kB\n" | ||
310 | "Private_Dirty: %8lu kB\n" | ||
311 | "Referenced: %8lu kB\n", | ||
312 | (vma->vm_end - vma->vm_start) >> 10, | ||
313 | mss.resident >> 10, | ||
314 | (unsigned long)(mss.pss >> (10 + PSS_SHIFT)), | ||
315 | mss.shared_clean >> 10, | ||
316 | mss.shared_dirty >> 10, | ||
317 | mss.private_clean >> 10, | ||
318 | mss.private_dirty >> 10, | ||
319 | mss.referenced >> 10); | ||
320 | |||
321 | return ret; | ||
322 | } | 322 | } |
323 | 323 | ||
324 | static struct mm_walk clear_refs_walk = { .pmd_entry = clear_refs_pte_range }; | 324 | static struct mm_walk clear_refs_walk = { .pmd_entry = clear_refs_pte_range }; |