| From: |
| "Matthew Wilcox (Oracle)" <willy-AT-infradead.org> |
| To: |
| Andrew Morton <akpm-AT-linux-foundation.org> |
| Subject: |
| [PATCH 0/2] vma_start_write_killable |
| Date: |
| Mon, 03 Nov 2025 18:03:44 +0000 |
| Message-ID: |
| <20251103180348.3368668-1-willy@infradead.org> |
| Cc: |
| "Matthew Wilcox (Oracle)" <willy-AT-infradead.org>, linux-mm-AT-kvack.org, Suren Baghdasaryan <surenb-AT-google.com>, "Liam R. Howlett" <Liam.Howlett-AT-oracle.com>, Lorenzo Stoakes <lorenzo.stoakes-AT-oracle.com>, Vlastimil Babka <vbabka-AT-suse.cz>, Shakeel Butt <shakeel.butt-AT-linux.dev>, Jann Horn <jannh-AT-google.com>, Pedro Falcato <pfalcato-AT-suse.de>, Chris Li <chriscli-AT-google.com> |
| Archive-link: |
| Article |
When we added the VMA lock, we made a major oversight in not adding a
killable variant. That can run us into trouble where a thread takes
the VMA lock for read (eg handling a page fault) and then goes out to
lunch for an hour (eg doing reclaim). Another thread tries to modify
the VMA, taking the mmap_lock for write, then attempts to lock the VMA
for write. That blocks on the first thread, and ensures that every
other page fault now tries to take the mmap_lock for read. Because
everything's in an uninterruptible sleep, we can't kill the task,
which makes me angry.
This patch set just adds vma_start_write_killable() and converts one
caller to use it. Most users are somewhat tricky to convert, so expect
follow-up individual patches per call-site which need careful analysis
to make sure we've done proper cleanup.
Matthew Wilcox (Oracle) (2):
mm: Add vma_start_write_killable()
mm: Use vma_start_write_killable() in dup_mmap()
include/linux/mmap_lock.h | 31 +++++++++++++++++++++++++++++--
mm/mmap.c | 12 +++---------
mm/mmap_lock.c | 27 ++++++++++++++++++---------
tools/testing/vma/vma_internal.h | 8 ++++++++
4 files changed, 58 insertions(+), 20 deletions(-)
--
2.47.2