lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7ooj3r2sxzqw3wn5mxog5kl5bi4arz3i2santgsqtxwlegsg6n@a3e6jdssdf42>
Date: Thu, 18 Dec 2025 14:11:54 +1100
From: Alistair Popple <apopple@...dia.com>
To: dan.j.williams@...el.com
Cc: John Groves <John@...ves.net>, David Hildenbrand <david@...nel.org>, 
	Oscar Salvador <osalvador@...e.de>, Andrew Morton <akpm@...ux-foundation.org>, 
	John Groves <jgroves@...ron.com>, "Darrick J . Wong" <djwong@...nel.org>, 
	Gregory Price <gourry@...rry.net>, Balbir Singh <bsingharora@...il.com>, linux-mm@...ck.org, 
	linux-kernel@...r.kernel.org, linux-cxl@...r.kernel.org, linux-fsdevel@...r.kernel.org, 
	Aravind Ramesh <arramesh@...ron.com>, Ajay Joshi <ajayjoshi@...ron.com>
Subject: Re: [PATCH] mm/memremap: fix spurious large folio warning for FS-DAX

On 2025-12-18 at 10:59 +1100, dan.j.williams@...el.com wrote...
> John Groves wrote:
> > From: John Groves <John@...ves.net>
> > 
> > This patch addresses a warning that I discovered while working on famfs,
> > which is an fs-dax file system that virtually always does PMD faults
> > (next famfs patch series coming after the holidays).
> > 
> > However, XFS also does PMD faults in fs-dax mode, and it also triggers
> > the warning. It takes some effort to get XFS to do a PMD fault, but
> > instructions to reproduce it are below.
> > 
> > The VM_WARN_ON_ONCE(folio_test_large(folio)) check in
> > free_zone_device_folio() incorrectly triggers for MEMORY_DEVICE_FS_DAX
> > when PMD (2MB) mappings are used.
> > 
> > FS-DAX legitimately creates large file-backed folios when handling PMD
> > faults. This is a core feature of FS-DAX that provides significant
> > performance benefits by mapping 2MB regions directly to persistent
> > memory. When these mappings are unmapped, the large folios are freed
> > through free_zone_device_folio(), which triggers the spurious warning.
> > 
> > The warning was introduced by commit that added support for large zone
> > device private folios. However, that commit did not account for FS-DAX
> > file-backed folios, which have always supported large (PMD-sized)
> > mappings.
> 
> Oh, I was not copied on:
> 
> d245f9b4ab80 mm/zone_device: support large zone device private folios
> 
> ...I should probably add myself as a reviewer to the MEMORY HOT(UN)PLUG
> entry in MAINTAINERS at least for the mm/mememap.c bits.
> 
> Now, why is the warning there in the first place?

Lets wait for Balbir to comment but I suspect it's just a mistake in
d245f9b4ab80 ("mm/zone_device: support large zone device private folios"):

-       /*
-        * Note: we don't expect anonymous compound pages yet. Once supported
-        * and we could PTE-map them similar to THP, we'd have to clear
-        * PG_anon_exclusive on all tail pages.
-        */
        if (folio_test_anon(folio)) {
-               VM_BUG_ON_FOLIO(folio_test_large(folio), folio);
-               __ClearPageAnonExclusive(folio_page(folio, 0));
+               for (i = 0; i < nr; i++)
+                       __ClearPageAnonExclusive(folio_page(folio, i));
+       } else {
+               VM_WARN_ON_ONCE(folio_test_large(folio));
        }

The warning never applied to !folio_test_anon() folios and was just a reminder
for the comment above which was deleted because it was fixed. Therefore the
warning should also have been deleted.

> I.e. what is the risk of just doing this fixup:

None, I think that is the correct fix.

> diff --git a/mm/memremap.c b/mm/memremap.c
> index 4c2e0d68eb27..63c6ab4fdf08 100644
> --- a/mm/memremap.c
> +++ b/mm/memremap.c
> @@ -427,8 +427,6 @@ void free_zone_device_folio(struct folio *folio)
>         if (folio_test_anon(folio)) {
>                 for (i = 0; i < nr; i++)
>                         __ClearPageAnonExclusive(folio_page(folio, i));
> -       } else {
> -               VM_WARN_ON_ONCE(folio_test_large(folio));
>         }
>  
>         /*
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ