[PATCH v6 0/5] mm: Fix MF_DELAYED handling on memory failure

Lisa Wang posted 5 patches 1 week ago
mm/memory-failure.c                         |  29 ++++---
mm/shmem.c                                  |   2 +-
tools/testing/selftests/mm/memory-failure.c | 114 +++++++++++++++++++++++++++-
3 files changed, 126 insertions(+), 19 deletions(-)
[PATCH v6 0/5] mm: Fix MF_DELAYED handling on memory failure
Posted by Lisa Wang 1 week ago
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-d97a5703e45a@google.com/

Signed-off-by: Lisa Wang <wyihan@google.com>
---
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 <wyihan@google.com>
Re: [PATCH v6 0/5] mm: Fix MF_DELAYED handling on memory failure
Posted by Andrew Morton 1 week ago
On Thu, 17 Sep 2026 20:43:46 +0000 Lisa Wang <wyihan@google.com> wrote:

> Here's a sixth revision to fix MF_DELAYED handling on memory failure.

Thanks.  Yourself and your reviewers.

I've added this to mm.git's mm-new branch.  If it doesn't break
horribly then after a few days I'll move it into the mm-unstable
branch, from where it will be pulled in linux-next.

All being well, a few weeks from now I'll move it into mm.git's
non-rebasing mm-stable branch.  mm-stable is where we assemble material
for upstreaming in the upcoming mainline merge window.