Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] docs: pagemap: fix flags location, member name and sample code
@ 2026-06-26 16:27 Zenghui Yu
  2026-06-26 16:36 ` David Hildenbrand (Arm)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Zenghui Yu @ 2026-06-26 16:27 UTC (permalink / raw)
  To: linux-mm, linux-doc, linux-kernel
  Cc: akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko, corbet,
	skhan, sj, Zenghui Yu

The userland visible page flags (KPF_*) were initially moved to
include/linux/kernel-page-flags.h in commit 1a9b5b7fe0c5 ("mm: export
stable page flags"), and later moved to
include/uapi/linux/kernel-page-flags.h in commit 607ca46e97a1 ("UAPI:
(Scripted) Disintegrate include/linux").  Update the doc to reflect the
current location of these flags.

The member @walk_end of struct pm_scan_arg {} was wrongly written as
"end_walk".

The first sample code of the PAGEMAP_SCAN ioctl wrongly used the
PM_SCAN_CHECK_WPASYNC flag twice, instead of the PM_SCAN_WP_MATCHING flag.
The second one included the wrong category in the required mask -
PAGE_IS_FILE should be used instead of PAGE_IS_SWAPPED as per the
intention.

Fix them all together.

Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>
---

* From v1 [1]:
  - drop PAGE_IS_SWAPPED in .category_mask (David)
  - fix typo in commit message (David)
  - didn't collect SeongJae's R-b (as the content has changed anyway) but
    thank you for that!

[1] https://lore.kernel.org/20260625174447.24292-1-zenghui.yu@linux.dev

 Documentation/admin-guide/mm/pagemap.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/admin-guide/mm/pagemap.rst b/Documentation/admin-guide/mm/pagemap.rst
index c57e61b5d8aa..20e3fe76f099 100644
--- a/Documentation/admin-guide/mm/pagemap.rst
+++ b/Documentation/admin-guide/mm/pagemap.rst
@@ -67,7 +67,7 @@ number of times a page is mapped.
  * ``/proc/kpageflags``.  This file contains a 64-bit set of flags for each
    page, indexed by PFN.
 
-   The flags are (from ``fs/proc/page.c``, above kpageflags_read):
+   The flags are (from ``include/uapi/linux/kernel-page-flags.h``):
 
     0. LOCKED
     1. ERROR
@@ -264,7 +264,7 @@ The ``struct pm_scan_arg`` is used as the argument of the IOCTL.
     provided or not.
  3. The range is specified through ``start`` and ``end``.
  4. The walk can abort before visiting the complete range such as the user buffer
-    can get full etc. The walk ending address is specified in``end_walk``.
+    can get full etc. The walk ending address is specified in ``walk_end``.
  5. The output buffer of ``struct page_region`` array and size is specified in
     ``vec`` and ``vec_len``.
  6. The optional maximum requested pages are specified in the ``max_pages``.
@@ -275,7 +275,7 @@ Find pages which have been written and WP them as well::
 
    struct pm_scan_arg arg = {
    .size = sizeof(arg),
-   .flags = PM_SCAN_CHECK_WPASYNC | PM_SCAN_CHECK_WPASYNC,
+   .flags = PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC,
    ..
    .category_mask = PAGE_IS_WRITTEN,
    .return_mask = PAGE_IS_WRITTEN,
@@ -288,7 +288,7 @@ present or huge::
    .size = sizeof(arg),
    .flags = 0,
    ..
-   .category_mask = PAGE_IS_WRITTEN | PAGE_IS_SWAPPED,
+   .category_mask = PAGE_IS_WRITTEN | PAGE_IS_FILE,
    .category_inverted = PAGE_IS_SWAPPED,
    .category_anyof_mask = PAGE_IS_PRESENT | PAGE_IS_HUGE,
    .return_mask = PAGE_IS_WRITTEN | PAGE_IS_SWAPPED |
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] docs: pagemap: fix flags location, member name and sample code
  2026-06-26 16:27 [PATCH v2] docs: pagemap: fix flags location, member name and sample code Zenghui Yu
@ 2026-06-26 16:36 ` David Hildenbrand (Arm)
  2026-06-27  0:15 ` SeongJae Park
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand (Arm) @ 2026-06-26 16:36 UTC (permalink / raw)
  To: Zenghui Yu, linux-mm, linux-doc, linux-kernel
  Cc: akpm, ljs, liam, vbabka, rppt, surenb, mhocko, corbet, skhan, sj

On 6/26/26 18:27, Zenghui Yu wrote:
> The userland visible page flags (KPF_*) were initially moved to
> include/linux/kernel-page-flags.h in commit 1a9b5b7fe0c5 ("mm: export
> stable page flags"), and later moved to
> include/uapi/linux/kernel-page-flags.h in commit 607ca46e97a1 ("UAPI:
> (Scripted) Disintegrate include/linux").  Update the doc to reflect the
> current location of these flags.
> 
> The member @walk_end of struct pm_scan_arg {} was wrongly written as
> "end_walk".
> 
> The first sample code of the PAGEMAP_SCAN ioctl wrongly used the
> PM_SCAN_CHECK_WPASYNC flag twice, instead of the PM_SCAN_WP_MATCHING flag.
> The second one included the wrong category in the required mask -
> PAGE_IS_FILE should be used instead of PAGE_IS_SWAPPED as per the
> intention.
> 
> Fix them all together.
> 
> Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] docs: pagemap: fix flags location, member name and sample code
  2026-06-26 16:27 [PATCH v2] docs: pagemap: fix flags location, member name and sample code Zenghui Yu
  2026-06-26 16:36 ` David Hildenbrand (Arm)
@ 2026-06-27  0:15 ` SeongJae Park
  2026-06-29  9:58 ` Lorenzo Stoakes
  2026-06-30 19:36 ` Jonathan Corbet
  3 siblings, 0 replies; 5+ messages in thread
From: SeongJae Park @ 2026-06-27  0:15 UTC (permalink / raw)
  To: Zenghui Yu
  Cc: SeongJae Park, linux-mm, linux-doc, linux-kernel, akpm, david,
	ljs, liam, vbabka, rppt, surenb, mhocko, corbet, skhan

On Sat, 27 Jun 2026 00:27:10 +0800 Zenghui Yu <zenghui.yu@linux.dev> wrote:

> The userland visible page flags (KPF_*) were initially moved to
> include/linux/kernel-page-flags.h in commit 1a9b5b7fe0c5 ("mm: export
> stable page flags"), and later moved to
> include/uapi/linux/kernel-page-flags.h in commit 607ca46e97a1 ("UAPI:
> (Scripted) Disintegrate include/linux").  Update the doc to reflect the
> current location of these flags.
> 
> The member @walk_end of struct pm_scan_arg {} was wrongly written as
> "end_walk".
> 
> The first sample code of the PAGEMAP_SCAN ioctl wrongly used the
> PM_SCAN_CHECK_WPASYNC flag twice, instead of the PM_SCAN_WP_MATCHING flag.
> The second one included the wrong category in the required mask -
> PAGE_IS_FILE should be used instead of PAGE_IS_SWAPPED as per the
> intention.
> 
> Fix them all together.
> 
> Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>
> ---
> 
> * From v1 [1]:
>   - drop PAGE_IS_SWAPPED in .category_mask (David)
>   - fix typo in commit message (David)

Good catches!

>   - didn't collect SeongJae's R-b (as the content has changed anyway) but
>     thank you for that!

Let me give it again :)

Reviewed-by: SeongJae Park <sj@kernel.org>

> 
> [1] https://lore.kernel.org/20260625174447.24292-1-zenghui.yu@linux.dev


Thanks,
SJ

[...]


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] docs: pagemap: fix flags location, member name and sample code
  2026-06-26 16:27 [PATCH v2] docs: pagemap: fix flags location, member name and sample code Zenghui Yu
  2026-06-26 16:36 ` David Hildenbrand (Arm)
  2026-06-27  0:15 ` SeongJae Park
@ 2026-06-29  9:58 ` Lorenzo Stoakes
  2026-06-30 19:36 ` Jonathan Corbet
  3 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Stoakes @ 2026-06-29  9:58 UTC (permalink / raw)
  To: Zenghui Yu
  Cc: linux-mm, linux-doc, linux-kernel, akpm, david, liam, vbabka,
	rppt, surenb, mhocko, corbet, skhan, sj

On Sat, Jun 27, 2026 at 12:27:10AM +0800, Zenghui Yu wrote:
> The userland visible page flags (KPF_*) were initially moved to
> include/linux/kernel-page-flags.h in commit 1a9b5b7fe0c5 ("mm: export
> stable page flags"), and later moved to
> include/uapi/linux/kernel-page-flags.h in commit 607ca46e97a1 ("UAPI:
> (Scripted) Disintegrate include/linux").  Update the doc to reflect the
> current location of these flags.
>
> The member @walk_end of struct pm_scan_arg {} was wrongly written as
> "end_walk".
>
> The first sample code of the PAGEMAP_SCAN ioctl wrongly used the
> PM_SCAN_CHECK_WPASYNC flag twice, instead of the PM_SCAN_WP_MATCHING flag.
> The second one included the wrong category in the required mask -
> PAGE_IS_FILE should be used instead of PAGE_IS_SWAPPED as per the
> intention.
>
> Fix them all together.
>
> Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>

LGTM, so:

Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>

> ---
>
> * From v1 [1]:
>   - drop PAGE_IS_SWAPPED in .category_mask (David)
>   - fix typo in commit message (David)
>   - didn't collect SeongJae's R-b (as the content has changed anyway) but
>     thank you for that!
>
> [1] https://lore.kernel.org/20260625174447.24292-1-zenghui.yu@linux.dev
>
>  Documentation/admin-guide/mm/pagemap.rst | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/admin-guide/mm/pagemap.rst b/Documentation/admin-guide/mm/pagemap.rst
> index c57e61b5d8aa..20e3fe76f099 100644
> --- a/Documentation/admin-guide/mm/pagemap.rst
> +++ b/Documentation/admin-guide/mm/pagemap.rst
> @@ -67,7 +67,7 @@ number of times a page is mapped.
>   * ``/proc/kpageflags``.  This file contains a 64-bit set of flags for each
>     page, indexed by PFN.
>
> -   The flags are (from ``fs/proc/page.c``, above kpageflags_read):
> +   The flags are (from ``include/uapi/linux/kernel-page-flags.h``):
>
>      0. LOCKED
>      1. ERROR
> @@ -264,7 +264,7 @@ The ``struct pm_scan_arg`` is used as the argument of the IOCTL.
>      provided or not.
>   3. The range is specified through ``start`` and ``end``.
>   4. The walk can abort before visiting the complete range such as the user buffer
> -    can get full etc. The walk ending address is specified in``end_walk``.
> +    can get full etc. The walk ending address is specified in ``walk_end``.
>   5. The output buffer of ``struct page_region`` array and size is specified in
>      ``vec`` and ``vec_len``.
>   6. The optional maximum requested pages are specified in the ``max_pages``.
> @@ -275,7 +275,7 @@ Find pages which have been written and WP them as well::
>
>     struct pm_scan_arg arg = {
>     .size = sizeof(arg),
> -   .flags = PM_SCAN_CHECK_WPASYNC | PM_SCAN_CHECK_WPASYNC,
> +   .flags = PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC,
>     ..
>     .category_mask = PAGE_IS_WRITTEN,
>     .return_mask = PAGE_IS_WRITTEN,
> @@ -288,7 +288,7 @@ present or huge::
>     .size = sizeof(arg),
>     .flags = 0,
>     ..
> -   .category_mask = PAGE_IS_WRITTEN | PAGE_IS_SWAPPED,
> +   .category_mask = PAGE_IS_WRITTEN | PAGE_IS_FILE,
>     .category_inverted = PAGE_IS_SWAPPED,
>     .category_anyof_mask = PAGE_IS_PRESENT | PAGE_IS_HUGE,
>     .return_mask = PAGE_IS_WRITTEN | PAGE_IS_SWAPPED |
> --
> 2.53.0
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] docs: pagemap: fix flags location, member name and sample code
  2026-06-26 16:27 [PATCH v2] docs: pagemap: fix flags location, member name and sample code Zenghui Yu
                   ` (2 preceding siblings ...)
  2026-06-29  9:58 ` Lorenzo Stoakes
@ 2026-06-30 19:36 ` Jonathan Corbet
  3 siblings, 0 replies; 5+ messages in thread
From: Jonathan Corbet @ 2026-06-30 19:36 UTC (permalink / raw)
  To: Zenghui Yu, linux-mm, linux-doc, linux-kernel
  Cc: akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko, skhan, sj,
	Zenghui Yu

Zenghui Yu <zenghui.yu@linux.dev> writes:

> The userland visible page flags (KPF_*) were initially moved to
> include/linux/kernel-page-flags.h in commit 1a9b5b7fe0c5 ("mm: export
> stable page flags"), and later moved to
> include/uapi/linux/kernel-page-flags.h in commit 607ca46e97a1 ("UAPI:
> (Scripted) Disintegrate include/linux").  Update the doc to reflect the
> current location of these flags.
>
> The member @walk_end of struct pm_scan_arg {} was wrongly written as
> "end_walk".
>
> The first sample code of the PAGEMAP_SCAN ioctl wrongly used the
> PM_SCAN_CHECK_WPASYNC flag twice, instead of the PM_SCAN_WP_MATCHING flag.
> The second one included the wrong category in the required mask -
> PAGE_IS_FILE should be used instead of PAGE_IS_SWAPPED as per the
> intention.
>
> Fix them all together.
>
> Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>
> ---
>
> * From v1 [1]:
>   - drop PAGE_IS_SWAPPED in .category_mask (David)
>   - fix typo in commit message (David)
>   - didn't collect SeongJae's R-b (as the content has changed anyway) but
>     thank you for that!
>
> [1] https://lore.kernel.org/20260625174447.24292-1-zenghui.yu@linux.dev
>
>  Documentation/admin-guide/mm/pagemap.rst | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

jon


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-30 19:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 16:27 [PATCH v2] docs: pagemap: fix flags location, member name and sample code Zenghui Yu
2026-06-26 16:36 ` David Hildenbrand (Arm)
2026-06-27  0:15 ` SeongJae Park
2026-06-29  9:58 ` Lorenzo Stoakes
2026-06-30 19:36 ` Jonathan Corbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox