[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aXv_HI8JM9mZCr4-@linux.dev>
Date: Thu, 29 Jan 2026 16:47:52 -0800
From: Shakeel Butt <shakeel.butt@...ux.dev>
To: Matthew Wilcox <willy@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>, Rik van Riel <riel@...riel.com>,
Song Liu <songliubraving@...com>, Kiryl Shutsemau <kas@...nel.org>,
Usama Arif <usamaarif642@...il.com>, David Hildenbrand <david@...nel.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Zi Yan <ziy@...dia.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>, "Liam R . Howlett" <Liam.Howlett@...cle.com>,
Nico Pache <npache@...hat.com>, Ryan Roberts <ryan.roberts@....com>, Dev Jain <dev.jain@....com>,
Barry Song <baohua@...nel.org>, Lance Yang <lance.yang@...ux.dev>,
Meta kernel team <kernel-team@...a.com>, linux-mm@...ck.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: khugepaged: fix NR_FILE_PAGES accounting in
collapse_file()
On Thu, Jan 29, 2026 at 10:47:16PM +0000, Matthew Wilcox wrote:
> On Thu, Jan 29, 2026 at 10:40:54AM -0800, Shakeel Butt wrote:
> > Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS")
>
> Are you sure this is the right Fixes? 99cb0dbd47a1 wasn't cgroup
> aware:
>
> if (nr_none) {
> struct zone *zone = page_zone(new_page);
>
> __mod_node_page_state(zone->zone_pgdat, NR_FILE_PAGES, nr_none);
> - __mod_node_page_state(zone->zone_pgdat, NR_SHMEM, nr_none);
> + if (is_shmem)
> + __mod_node_page_state(zone->zone_pgdat,
> + NR_SHMEM, nr_none);
> }
>
> b8eddff8886b added cgroup support:
>
> if (is_shmem)
> - __inc_node_page_state(new_page, NR_SHMEM_THPS);
> + __inc_lruvec_page_state(new_page, NR_SHMEM_THPS);
> else {
> - __inc_node_page_state(new_page, NR_FILE_THPS);
> + __inc_lruvec_page_state(new_page, NR_FILE_THPS);
> filemap_nr_thps_inc(mapping);
> }
>
> which would seem like the right Fixes: to me?
>
b8eddff8886b is about different stats NR_SHMEM_THPS & NR_FILE_THPS.
However as Johannes responded this code was broken even before memcg
awareness for NR_FILE_PAGES and NR_SHMEM.
I will send v2 with correct handling of NR_SHMEM as well.
Powered by blists - more mailing lists