|
|
Log in / Subscribe / Register

Simplify filemap faults

From:  "Matthew Wilcox (Oracle)" <willy-AT-infradead.org>
To:  linux-mm-AT-kvack.org
Subject:  [PATCH 00/11] Simplify filemap faults
Date:  Thu, 25 Jun 2026 20:50:26 +0100
Message-ID:  <20260625195040.2508362-1-willy@infradead.org>
Cc:  "Matthew Wilcox (Oracle)" <willy-AT-infradead.org>
Archive-link:  Article

This is a fairly bold and opinionated patchset.

First, I think all calls to filemap_get_folio() (and its variants) all
check for errors.  That being the case, it's fine to stop trying to lock
a folio if there's a fatal signal.  I just didn't want to introduce a
FGP_KILLABLE flag ...

Second, I'm taking the position that all faults should be interruptible by
fatal signals, and therefore we don't need FAULT_FLAG_KILLABLE any more.
There were still places which didn't specify FAULT_FLAG_KILLABLE, but
they all handle errors being returned by handle_mm_fault(), and I think
they're all fine.

Third, we don't need to drop the fault lock in order to wait on reads
any more now we have VMA locking for faults.

Patch 8 actually fixes a bug ... I should probably move it up to the
front, but I've run out of time for today.

The diffstat is pretty pleasing, as is the reduction in complexity.
It's not as reduced as I'd like it to be, but it's a few steps in the
right direction.

Let's see what the various bots think of this.  My xfstests run didn't
show anything abnormal. but I'm not convinced it tests many of the
corner cases.

Matthew Wilcox (Oracle) (11):
  filemap: Lock folios killably in __filemap_get_folio_mpol()
  mm: Make all page faults killable
  filemap: Do sync readahead under the fault lock
  filemap: Do async readahead under the fault lock
  filemap: Do not pin the file when locking the folio
  filemap: Do synchronous reads under the fault lock
  mm: Remove fpin argument from maybe_unlock_mmap_for_io()
  filemap: Honour FAULT_FLAG_RETRY_NOWAIT when creating a folio
  filemap: Handle folio locking in __filemap_get_folio()
  mm: Do not release fault lock while handling write fault
  mm: Remove VM_FAULT_COMPLETED

 arch/alpha/mm/fault.c         |   4 -
 arch/arc/mm/fault.c           |   4 -
 arch/arm/mm/fault.c           |   6 +-
 arch/arm64/mm/fault.c         |   6 +-
 arch/csky/mm/fault.c          |   4 -
 arch/hexagon/mm/vm_fault.c    |   4 -
 arch/loongarch/mm/fault.c     |   6 +-
 arch/m68k/mm/fault.c          |   4 -
 arch/microblaze/mm/fault.c    |   4 -
 arch/mips/mm/fault.c          |   4 -
 arch/nios2/mm/fault.c         |   4 -
 arch/openrisc/mm/fault.c      |   4 -
 arch/parisc/mm/fault.c        |   4 -
 arch/powerpc/mm/copro_fault.c |   5 -
 arch/powerpc/mm/fault.c       |   7 +-
 arch/riscv/mm/fault.c         |   6 +-
 arch/s390/mm/fault.c          |   6 +-
 arch/sh/mm/fault.c            |   4 -
 arch/sparc/mm/fault_32.c      |   4 -
 arch/sparc/mm/fault_64.c      |   5 -
 arch/um/kernel/trap.c         |   4 -
 arch/x86/mm/fault.c           |  18 ++--
 arch/xtensa/mm/fault.c        |   4 -
 include/linux/mm.h            |   2 -
 include/linux/mm_types.h      |  21 ++--
 include/linux/pagemap.h       |   8 +-
 mm/filemap.c                  | 174 ++++++++++------------------------
 mm/gup.c                      |  41 +-------
 mm/internal.h                 |   7 +-
 mm/memory.c                   |  25 ++---
 mm/shmem.c                    |   2 +-
 mm/userfaultfd.c              |  20 ++--
 32 files changed, 90 insertions(+), 331 deletions(-)

-- 
2.47.3




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds