diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/task_mmu.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 7c89b4549049..7e5e7ec2e36d 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -203,13 +203,14 @@ static void smaps_pte_range(struct vm_area_struct *vma, pmd_t *pmd, | |||
203 | struct mem_size_stats *mss) | 203 | struct mem_size_stats *mss) |
204 | { | 204 | { |
205 | pte_t *pte, ptent; | 205 | pte_t *pte, ptent; |
206 | spinlock_t *ptl; | ||
206 | unsigned long pfn; | 207 | unsigned long pfn; |
207 | struct page *page; | 208 | struct page *page; |
208 | 209 | ||
209 | pte = pte_offset_map(pmd, addr); | 210 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
210 | do { | 211 | do { |
211 | ptent = *pte; | 212 | ptent = *pte; |
212 | if (pte_none(ptent) || !pte_present(ptent)) | 213 | if (!pte_present(ptent)) |
213 | continue; | 214 | continue; |
214 | 215 | ||
215 | mss->resident += PAGE_SIZE; | 216 | mss->resident += PAGE_SIZE; |
@@ -230,8 +231,8 @@ static void smaps_pte_range(struct vm_area_struct *vma, pmd_t *pmd, | |||
230 | mss->private_clean += PAGE_SIZE; | 231 | mss->private_clean += PAGE_SIZE; |
231 | } | 232 | } |
232 | } while (pte++, addr += PAGE_SIZE, addr != end); | 233 | } while (pte++, addr += PAGE_SIZE, addr != end); |
233 | pte_unmap(pte - 1); | 234 | pte_unmap_unlock(pte - 1, ptl); |
234 | cond_resched_lock(&vma->vm_mm->page_table_lock); | 235 | cond_resched(); |
235 | } | 236 | } |
236 | 237 | ||
237 | static inline void smaps_pmd_range(struct vm_area_struct *vma, pud_t *pud, | 238 | static inline void smaps_pmd_range(struct vm_area_struct *vma, pud_t *pud, |
@@ -285,17 +286,11 @@ static inline void smaps_pgd_range(struct vm_area_struct *vma, | |||
285 | static int show_smap(struct seq_file *m, void *v) | 286 | static int show_smap(struct seq_file *m, void *v) |
286 | { | 287 | { |
287 | struct vm_area_struct *vma = v; | 288 | struct vm_area_struct *vma = v; |
288 | struct mm_struct *mm = vma->vm_mm; | ||
289 | struct mem_size_stats mss; | 289 | struct mem_size_stats mss; |
290 | 290 | ||
291 | memset(&mss, 0, sizeof mss); | 291 | memset(&mss, 0, sizeof mss); |
292 | 292 | if (vma->vm_mm) | |
293 | if (mm) { | ||
294 | spin_lock(&mm->page_table_lock); | ||
295 | smaps_pgd_range(vma, vma->vm_start, vma->vm_end, &mss); | 293 | smaps_pgd_range(vma, vma->vm_start, vma->vm_end, &mss); |
296 | spin_unlock(&mm->page_table_lock); | ||
297 | } | ||
298 | |||
299 | return show_map_internal(m, v, &mss); | 294 | return show_map_internal(m, v, &mss); |
300 | } | 295 | } |
301 | 296 | ||