task_mmu.c (acdce7aa7a4fc1094661feb0b833ae2eec2ad2d0) task_mmu.c (d09e8ca6cb93bb4b97517a18fbbf7eccb0e9ff43)
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/pagewalk.h>
3#include <linux/mm_inline.h>
4#include <linux/hugetlb.h>
5#include <linux/huge_mm.h>
6#include <linux/mount.h>
7#include <linux/seq_file.h>
8#include <linux/highmem.h>

--- 260 unchanged lines hidden (view full) ---

269 seq_put_hex_ll(m, ":", MINOR(dev), 2);
270 seq_put_decimal_ull(m, " ", ino);
271 seq_putc(m, ' ');
272}
273
274static void
275show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
276{
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/pagewalk.h>
3#include <linux/mm_inline.h>
4#include <linux/hugetlb.h>
5#include <linux/huge_mm.h>
6#include <linux/mount.h>
7#include <linux/seq_file.h>
8#include <linux/highmem.h>

--- 260 unchanged lines hidden (view full) ---

269 seq_put_hex_ll(m, ":", MINOR(dev), 2);
270 seq_put_decimal_ull(m, " ", ino);
271 seq_putc(m, ' ');
272}
273
274static void
275show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
276{
277 struct anon_vma_name *anon_name = NULL;
277 struct mm_struct *mm = vma->vm_mm;
278 struct file *file = vma->vm_file;
279 vm_flags_t flags = vma->vm_flags;
280 unsigned long ino = 0;
281 unsigned long long pgoff = 0;
282 unsigned long start, end;
283 dev_t dev = 0;
284 const char *name = NULL;
285
286 if (file) {
287 struct inode *inode = file_inode(vma->vm_file);
288 dev = inode->i_sb->s_dev;
289 ino = inode->i_ino;
290 pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
291 }
292
293 start = vma->vm_start;
294 end = vma->vm_end;
295 show_vma_header_prefix(m, start, end, flags, pgoff, dev, ino);
278 struct mm_struct *mm = vma->vm_mm;
279 struct file *file = vma->vm_file;
280 vm_flags_t flags = vma->vm_flags;
281 unsigned long ino = 0;
282 unsigned long long pgoff = 0;
283 unsigned long start, end;
284 dev_t dev = 0;
285 const char *name = NULL;
286
287 if (file) {
288 struct inode *inode = file_inode(vma->vm_file);
289 dev = inode->i_sb->s_dev;
290 ino = inode->i_ino;
291 pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
292 }
293
294 start = vma->vm_start;
295 end = vma->vm_end;
296 show_vma_header_prefix(m, start, end, flags, pgoff, dev, ino);
297 if (mm)
298 anon_name = anon_vma_name(vma);
296
297 /*
298 * Print the dentry name for named mappings, and a
299 * special [heap] marker for the heap:
300 */
301 if (file) {
302 seq_pad(m, ' ');
299
300 /*
301 * Print the dentry name for named mappings, and a
302 * special [heap] marker for the heap:
303 */
304 if (file) {
305 seq_pad(m, ' ');
303 seq_file_path(m, file, "\n");
306 /*
307 * If user named this anon shared memory via
308 * prctl(PR_SET_VMA ..., use the provided name.
309 */
310 if (anon_name)
311 seq_printf(m, "[anon_shmem:%s]", anon_name->name);
312 else
313 seq_file_path(m, file, "\n");
304 goto done;
305 }
306
307 if (vma->vm_ops && vma->vm_ops->name) {
308 name = vma->vm_ops->name(vma);
309 if (name)
310 goto done;
311 }
312
313 name = arch_vma_name(vma);
314 if (!name) {
314 goto done;
315 }
316
317 if (vma->vm_ops && vma->vm_ops->name) {
318 name = vma->vm_ops->name(vma);
319 if (name)
320 goto done;
321 }
322
323 name = arch_vma_name(vma);
324 if (!name) {
315 struct anon_vma_name *anon_name;
316
317 if (!mm) {
318 name = "[vdso]";
319 goto done;
320 }
321
322 if (vma->vm_start <= mm->brk &&
323 vma->vm_end >= mm->start_brk) {
324 name = "[heap]";
325 goto done;
326 }
327
328 if (is_stack(vma)) {
329 name = "[stack]";
330 goto done;
331 }
332
325 if (!mm) {
326 name = "[vdso]";
327 goto done;
328 }
329
330 if (vma->vm_start <= mm->brk &&
331 vma->vm_end >= mm->start_brk) {
332 name = "[heap]";
333 goto done;
334 }
335
336 if (is_stack(vma)) {
337 name = "[stack]";
338 goto done;
339 }
340
333 anon_name = anon_vma_name(vma);
334 if (anon_name) {
335 seq_pad(m, ' ');
336 seq_printf(m, "[anon:%s]", anon_name->name);
337 }
338 }
339
340done:
341 if (name) {

--- 1687 unchanged lines hidden ---
341 if (anon_name) {
342 seq_pad(m, ' ');
343 seq_printf(m, "[anon:%s]", anon_name->name);
344 }
345 }
346
347done:
348 if (name) {

--- 1687 unchanged lines hidden ---