Re: [PATCH v3] tools/mm: Add script to display page state for a given PID and VADDR

Florian Weimer
2025-04-23T09:46:09Z

* Ye Liu:

> From: Ye Liu <liuye@kylinos.cn>
>
> Introduces a new drgn script, `show_page_info.py`, which allows users
> to analyze the state of a page given a process ID (PID) and a virtual
> address (VADDR). This can help kernel developers or debuggers easily
> inspect page-related information in a live kernel or vmcore.
>
> The script extracts information such as the page flags, mapping, and
> other metadata relevant to diagnosing memory issues.
>
> Output example:
> sudo ./show_page_info.py 1 0x7f43df5acf00
> PID: 1 Comm: systemd mm: 0xffff8881273bbc40
> Raw: 0017ffffc000416c ffffea00043a4508 ffffea0004381e08 ffff88810f086a70
> Raw: 0000000000000000 ffff888120c9b0c0 0000002500000007 ffff88812642c000
> User Virtual Address: 0x7f43df5acf00
> Page Address: 0xffffea00049a0b00
> Page Flags: PG_referenced|PG_uptodate|PG_lru|PG_head|PG_active|
> PG_private|PG_reported
> Page Size: 16384
> Page PFN: 0x12682c
> Page Physical: 0x12682c000
> Page Virtual: 0xffff88812682c000
> Page Refcount: 37
> Page Mapcount: 7
> Page Index: 0x0
> Page Memcg Data: 0xffff88812642c000
> Memcg Name: init.scope
> Memcg Path: /sys/fs/cgroup/memory/init.scope
> Page Mapping: 0xffff88810f086a70
> Page Anon/File: File
> Page VMA: 0xffff88810e4af3b8
> VMA Start: 0x7f43df5ac000
> VMA End: 0x7f43df5b0000
> This page is part of a compound page.
> This page is the head page of a compound page.
> Head Page: 0xffffea00049a0b00
> Compound Order: 2
> Number of Pages: 4

Does this show the page access flags anywhere in the output? If not,
would it be possible to include this information?

Thanks,
Florian