[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251218160332.ee5b1c9b2ac7aebabbabfa45@linux-foundation.org>
Date: Thu, 18 Dec 2025 16:03:32 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Alistair Popple <apopple@...dia.com>
Cc: John Groves <John@...ves.net>, David Hildenbrand <david@...nel.org>,
Oscar Salvador <osalvador@...e.de>, John Groves <jgroves@...ron.com>,
"Darrick J . Wong" <djwong@...nel.org>, Dan Williams
<dan.j.williams@...el.com>, 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 Thu, 18 Dec 2025 09:58:02 +1100 Alistair Popple <apopple@...dia.com> wrote:
> On 2025-12-18 at 08:13 +1100, John Groves <John@...ves.net> 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.
>
> Yep, and I'm pretty sure devdax can also create large folios so we might need
> a similar fix there. In fact looking at old vs. new code it seems we only ever
> used to have this warning for anon folios, which I think could only ever be true
> for DEVICE_PRIVATE or DEVICE_COHERENT folios.
>
> So I suspect the proper fix is to just remove the warning entirely now that they
> also support compound sizes.
So I'm assuming we can expect an updated version of this fix.
> > 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.
>
> Right, one of the nice side-effects (other than delaying fam-fs, sorry! :-/) of
> fixing the refcounting was that these started looking like normal large folios.
>
> > The check distinguishes between anonymous folios (which clear
> > AnonExclusive flags for each sub-page) and file-backed folios. For
> > file-backed folios, it assumes large folios are unexpected - but this
> > assumption is incorrect for FS-DAX.
> >
> > The fix is to exempt MEMORY_DEVICE_FS_DAX from the large folio warning,
> > allowing FS-DAX to continue using PMD mappings without triggering false
> > warnings.
>
> As this is a fix you will want a "Fixes:" tag.
Someone (possibly me) already added
Fixes: d245f9b4ab80 ("mm/zone_device: support large zone device private folios")
Powered by blists - more mailing lists