Skip to content

Commit 077d925

Browse files
jagalacticakpm00
authored andcommitted
mm/memremap: fix spurious large folio warning for FS-DAX
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. 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. Link: https://lkml.kernel.org/r/[email protected] Fixes: d245f9b ("mm/zone_device: support large zone device private folios") Signed-off-by: John Groves <[email protected]> Acked-by: David Hildenbrand (Red Hat) <[email protected]> Reviewed-by: Dan Williams <[email protected]> Tested-by: Alison Schofield <[email protected]> Cc: Alistair Popple <[email protected]> Cc: Balbir Singh <[email protected]> Cc: "Darrick J. Wong" <[email protected]> Cc: Gregory Price <[email protected]> Cc: Oscar Salvador <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent ffd042a commit 077d925

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

mm/memremap.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,6 @@ void free_zone_device_folio(struct folio *folio)
427427
if (folio_test_anon(folio)) {
428428
for (i = 0; i < nr; i++)
429429
__ClearPageAnonExclusive(folio_page(folio, i));
430-
} else {
431-
VM_WARN_ON_ONCE(folio_test_large(folio));
432430
}
433431

434432
/*

0 commit comments

Comments
 (0)