summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlipeifeng <lipeifeng@oppo.com>2023-06-22 06:01:52 +0200
committerAndrew Morton <akpm@linux-foundation.org>2023-06-24 01:59:32 +0200
commit341d51c8861fe05a8b3ea317f03f26aa0fb30710 (patch)
treece11bfb747a1dc0c5ad53ec7d6dd141b4cbe8b00
parenthugetlb: revert use of page_cache_next_miss() (diff)
downloadlinux-341d51c8861fe05a8b3ea317f03f26aa0fb30710.tar.xz
linux-341d51c8861fe05a8b3ea317f03f26aa0fb30710.zip
mm: nommu: correct the range of mmap_sem_read_lock in task_mem()
During the seq_printf,the mmap_sem_read_lock protection is not required. Link: https://lkml.kernel.org/r/20230622040152.1173-1-lipeifeng@oppo.com Signed-off-by: lipeifeng <lipeifeng@oppo.com> Cc: David Hildenbrand <david@redhat.com> Cc: Liam R. Howlett <Liam.Howlett@oracle.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--fs/proc/task_nommu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 0ec35072a8e5..2c8b62265981 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -51,7 +51,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm)
sbytes += kobjsize(mm);
else
bytes += kobjsize(mm);
-
+
if (current->fs && current->fs->users > 1)
sbytes += kobjsize(current->fs);
else
@@ -69,13 +69,13 @@ void task_mem(struct seq_file *m, struct mm_struct *mm)
bytes += kobjsize(current); /* includes kernel stack */
+ mmap_read_unlock(mm);
+
seq_printf(m,
"Mem:\t%8lu bytes\n"
"Slack:\t%8lu bytes\n"
"Shared:\t%8lu bytes\n",
bytes, slack, sbytes);
-
- mmap_read_unlock(mm);
}
unsigned long task_vsize(struct mm_struct *mm)