diff options
-rw-r--r-- | fs/proc/task_mmu.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 4806830ea2a1..b770c095e45c 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -198,11 +198,8 @@ static int do_maps_open(struct inode *inode, struct file *file, | |||
198 | return ret; | 198 | return ret; |
199 | } | 199 | } |
200 | 200 | ||
201 | static int show_map(struct seq_file *m, void *v) | 201 | static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma) |
202 | { | 202 | { |
203 | struct proc_maps_private *priv = m->private; | ||
204 | struct task_struct *task = priv->task; | ||
205 | struct vm_area_struct *vma = v; | ||
206 | struct mm_struct *mm = vma->vm_mm; | 203 | struct mm_struct *mm = vma->vm_mm; |
207 | struct file *file = vma->vm_file; | 204 | struct file *file = vma->vm_file; |
208 | int flags = vma->vm_flags; | 205 | int flags = vma->vm_flags; |
@@ -254,6 +251,15 @@ static int show_map(struct seq_file *m, void *v) | |||
254 | } | 251 | } |
255 | } | 252 | } |
256 | seq_putc(m, '\n'); | 253 | seq_putc(m, '\n'); |
254 | } | ||
255 | |||
256 | static int show_map(struct seq_file *m, void *v) | ||
257 | { | ||
258 | struct vm_area_struct *vma = v; | ||
259 | struct proc_maps_private *priv = m->private; | ||
260 | struct task_struct *task = priv->task; | ||
261 | |||
262 | show_map_vma(m, vma); | ||
257 | 263 | ||
258 | if (m->count < m->size) /* vma is copied successfully */ | 264 | if (m->count < m->size) /* vma is copied successfully */ |
259 | m->version = (vma != get_gate_vma(task))? vma->vm_start: 0; | 265 | m->version = (vma != get_gate_vma(task))? vma->vm_start: 0; |
@@ -364,9 +370,10 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | |||
364 | 370 | ||
365 | static int show_smap(struct seq_file *m, void *v) | 371 | static int show_smap(struct seq_file *m, void *v) |
366 | { | 372 | { |
373 | struct proc_maps_private *priv = m->private; | ||
374 | struct task_struct *task = priv->task; | ||
367 | struct vm_area_struct *vma = v; | 375 | struct vm_area_struct *vma = v; |
368 | struct mem_size_stats mss; | 376 | struct mem_size_stats mss; |
369 | int ret; | ||
370 | struct mm_walk smaps_walk = { | 377 | struct mm_walk smaps_walk = { |
371 | .pmd_entry = smaps_pte_range, | 378 | .pmd_entry = smaps_pte_range, |
372 | .mm = vma->vm_mm, | 379 | .mm = vma->vm_mm, |
@@ -378,9 +385,7 @@ static int show_smap(struct seq_file *m, void *v) | |||
378 | if (vma->vm_mm && !is_vm_hugetlb_page(vma)) | 385 | if (vma->vm_mm && !is_vm_hugetlb_page(vma)) |
379 | walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk); | 386 | walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk); |
380 | 387 | ||
381 | ret = show_map(m, v); | 388 | show_map_vma(m, vma); |
382 | if (ret) | ||
383 | return ret; | ||
384 | 389 | ||
385 | seq_printf(m, | 390 | seq_printf(m, |
386 | "Size: %8lu kB\n" | 391 | "Size: %8lu kB\n" |
@@ -402,7 +407,9 @@ static int show_smap(struct seq_file *m, void *v) | |||
402 | mss.referenced >> 10, | 407 | mss.referenced >> 10, |
403 | mss.swap >> 10); | 408 | mss.swap >> 10); |
404 | 409 | ||
405 | return ret; | 410 | if (m->count < m->size) /* vma is copied successfully */ |
411 | m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0; | ||
412 | return 0; | ||
406 | } | 413 | } |
407 | 414 | ||
408 | static const struct seq_operations proc_pid_smaps_op = { | 415 | static const struct seq_operations proc_pid_smaps_op = { |