Here's a sixth revision to fix MF_DELAYED handling on memory failure. This patch series addresses an issue in the memory failure handling path where MF_DELAYED is incorrectly treated as an error. This issue was discovered while testing memory failure handling for guest_memfd.
The proposed solution involves - 1. Clarifying the definition of MF_DELAYED to mean that memory failure handling is only partially completed, and that the metadata for the memory that failed (as in struct page/folio) is still referenced. 2. Updating shmem’s handling to align with the clarified definition. 3. Updating how the result of .error_remove_folio() is interpreted. Changes from v5: Add comment-style fallthrough in the memory-failure test, as suggested by Ackerley and David + RFC v5: https://lore.kernel.org/all/20260823-memory-failure-mf-delayed-fix-v5-0-d97a5703e...@google.com/ Signed-off-by: Lisa Wang <[email protected]> --- Lisa Wang (5): mm: memory_failure: Clarify the MF_DELAYED definition mm: memory_failure: Allow truncate_error_folio to return MF_DELAYED mm: shmem: Update shmem handler to the MF_DELAYED definition mm: memory_failure: Generalize extra_pins handling to all MF_DELAYED cases mm: selftests: Add shmem into memory failure test mm/memory-failure.c | 29 ++++--- mm/shmem.c | 2 +- tools/testing/selftests/mm/memory-failure.c | 114 +++++++++++++++++++++++++++- 3 files changed, 126 insertions(+), 19 deletions(-) --- base-commit: 08745c62350126bc31b09548137be87e2866f628 change-id: 20260527-memory-failure-mf-delayed-fix-7d5a8f4a8a8b Best regards, -- Lisa Wang <[email protected]>

