[PATCH v2 00/10] mm/thp: fix THP splitting unmap BUGs and related (fwd)

From: Hugh Dickins
Date: Wed Jun 09 2021 - 00:04:49 EST




---------- Forwarded message ----------
Date: Tue, 8 Jun 2021 20:57:34 -0700 (PDT)
From: Hugh Dickins <hughd@xxxxxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Hugh Dickins <hughd@xxxxxxxxxx>,
Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>,
Yang Shi <shy828301@xxxxxxxxx>, Wang Yugui <wangyugui@xxxxxxxxxxxx>,
Matthew Wilcox <willy@xxxxxxxxxxxxx>,
Naoya Horiguchi <naoya.horiguchi@xxxxxxx>,
Alistair Popple <apopple@xxxxxxxxxx>, Ralph Campbell <rcampbell@xxxxxxxxxx>,
Zi Yan <ziy@xxxxxxxxxx>, Miaohe Lin <linmiaohe@xxxxxxxxxx>,
Minchan Kim <minchan@xxxxxxxxxx>, Jue Wang <juew@xxxxxxxxxx>,
Peter Xu <peterx@xxxxxxxxxx>, Jan Kara <jack@xxxxxxx>,
Shakeel Butt <shakeelb@xxxxxxxxxx>, Oscar Salvador <osalvador@xxxxxxx>
Subject: [PATCH v2 00/10] mm/thp: fix THP splitting unmap BUGs and related

Here is v2 batch of long-standing THP bug fixes that I had not got
around to sending before, but prompted now by Wang Yugui's report
https://lore.kernel.org/linux-mm/20210412180659.B9E3.409509F4@xxxxxxxxxxxx/

Wang Yugui has tested a rollup of these fixes applied to 5.10.39,
and they have done no harm, but have *not* fixed that issue:
something more is needed and I have no idea of what.

But at least these clear up related issues, and should go to stable
(except for the last three). Some of these are fully reviewed and
tags added, others have been waiting on this v2 respin.

For now I've left out the bigger page_vma_mapped_walk() one (was 5/7):
I'm still working on splitting that up for Kirill's review, better get
the rest out before completing and posting that as a separate series.

2/10 here replaces part of 1/7 before; 7/10 and 8/10 from Yang Shi
inserted; 10/10 added to apply TTU_SYNC in mm/memory-failure.c.

These are against 5.13-rc5: expect mmotm conflicts with a couple of
Alistair Popple's "Add support for SVM atomics in Nouveau" series:
mm-remove-special-swap-entry-functions.patch
mm-rmap-split-try_to_munlock-from-try_to_unmap.patch

Suggested adjustments to Alistair's sent June 3rd, but I've not
rechecked (a couple of changes since v1 should reduce the damage
slightly).

01/10 mm/thp: fix __split_huge_pmd_locked() on shmem migration entry
02/10 mm/thp: make is_huge_zero_pmd() safe and quicker
03/10 mm/thp: try_to_unmap() use TTU_SYNC for safe splitting
04/10 mm/thp: fix vma_address() if virtual address below file offset
05/10 mm/thp: fix page_address_in_vma() on file THP tails
06/10 mm/thp: unmap_mapping_page() to fix THP truncate_cleanup_page()
07/10 mm: thp: replace DEBUG_VM BUG with VM_WARN when unmap fails for split
08/10 mm: rmap: make try_to_unmap() void function
09/10 mm/thp: remap_page() is only needed on anonymous THP
10/10 mm: hwpoison_user_mappings() try_to_unmap() with TTU_SYNC

include/linux/huge_mm.h | 8 ++++-
include/linux/mm.h | 3 ++
include/linux/rmap.h | 3 +-
mm/huge_memory.c | 61 +++++++++++++++++++++++-------------------
mm/internal.h | 51 ++++++++++++++++++++++++++---------
mm/memory-failure.c | 17 +++++------
mm/memory.c | 40 +++++++++++++++++++++++++++
mm/page_vma_mapped.c | 27 +++++++++++-------
mm/pgtable-generic.c | 5 +--
mm/rmap.c | 38 +++++++++++++++-----------
mm/truncate.c | 43 +++++++++++++----------------
mm/vmscan.c | 3 +-
12 files changed, 195 insertions(+), 104 deletions(-)

Hugh