Re: [PATCH v5 4/4] mm: correct the docs for thp_fault_alloc and thp_fault_fallback

From: Ryan Roberts
Date: Fri Apr 12 2024 - 06:21:27 EST


On 12/04/2024 08:37, Barry Song wrote:
> From: Barry Song <v-songbaohua@xxxxxxxx>
>
> The documentation does not align with the code. In
> __do_huge_pmd_anonymous_page(), THP_FAULT_FALLBACK is incremented when
> mem_cgroup_charge() fails, despite the allocation succeeding, whereas
> THP_FAULT_ALLOC is only incremented after a successful charge.
>
> Signed-off-by: Barry Song <v-songbaohua@xxxxxxxx>
> Cc: Chris Li <chrisl@xxxxxxxxxx>
> Cc: David Hildenbrand <david@xxxxxxxxxx>
> Cc: Domenico Cerasuolo <cerasuolodomenico@xxxxxxxxx>
> Cc: Kairui Song <kasong@xxxxxxxxxxx>
> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> Cc: Peter Xu <peterx@xxxxxxxxxx>
> Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
> Cc: Suren Baghdasaryan <surenb@xxxxxxxxxx>
> Cc: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
> Cc: Yu Zhao <yuzhao@xxxxxxxxxx>
> Cc: Jonathan Corbet <corbet@xxxxxxx>

Reviewed-by: Ryan Roberts <ryan.roberts@xxxxxxx>

> ---
> Documentation/admin-guide/mm/transhuge.rst | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst
> index f436ff982f22..98e3a99ea780 100644
> --- a/Documentation/admin-guide/mm/transhuge.rst
> +++ b/Documentation/admin-guide/mm/transhuge.rst
> @@ -369,7 +369,7 @@ monitor how successfully the system is providing huge pages for use.
>
> thp_fault_alloc
> is incremented every time a huge page is successfully
> - allocated to handle a page fault.
> + allocated and charged to handle a page fault.
>
> thp_collapse_alloc
> is incremented by khugepaged when it has found
> @@ -377,7 +377,7 @@ thp_collapse_alloc
> successfully allocated a new huge page to store the data.
>
> thp_fault_fallback
> - is incremented if a page fault fails to allocate
> + is incremented if a page fault fails to allocate or charge
> a huge page and instead falls back to using small pages.
>
> thp_fault_fallback_charge