Re: [PATCH 0/7] mm/thp: fix THP splitting unmap BUGs and related
From: Alistair Popple
Date: Tue Jun 01 2021 - 22:07:14 EST
On Wednesday, 2 June 2021 7:03:30 AM AEST Hugh Dickins wrote:
> Here is a 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, which is just an optimization: it would be
> fine in stable, but it's not required there).
>
> These are against 5.13-rc4: easy for others to try out, but my next
> task is to work out how to shoehorn them into mmotm and linux-next.
>
> I would have said just before Yang Shi's related
> mm-thp-replace-debug_vm-bug-with-vm_warn-when-unmap-fails-for-split.patch
> except that (which should also go to stable) is currently placed after
> Alistair Popple's "Add support for SVM atomics in Nouveau" series,
> mm-rmap-split-try_to_munlock-from-try_to_unmap.patch etc.
> I expect I shall offer you some rediffs of Alistair's, we'll see.
I haven't looked at Yang Shi's patch yet but aside from patch 2 this series
applies on top of mine fairly easily. The only other issue I noticed was
needing to rename migration_entry_to_page() -> pfn_swap_entry_to_page() in
patch 1 & 7 before applying.
> 1/7 mm/thp: fix __split_huge_pmd_locked() on shmem migration entry
> 2/7 mm/thp: try_to_unmap() use TTU_SYNC for safe DEBUG_VM splitting
> 3/7 mm/thp: fix vma_address() if virtual address below file offset
> 4/7 mm/thp: fix page_address_in_vma() on file THP tails
> 5/7 mm/thp: fix page_vma_mapped_walk() if huge page mapped by ptes
> 6/7 mm/thp: unmap_mapping_page() to fix THP truncate_cleanup_page()
> 7/7 mm/thp: remap_page() is only needed on anonymous THP
>
> include/linux/mm.h | 3
> include/linux/rmap.h | 3
> mm/huge_memory.c | 47 ++++++++----
> mm/internal.h | 54 ++++++++++----
> mm/memory.c | 40 ++++++++++
> mm/page_vma_mapped.c | 163 ++++++++++++++++++++++++++-----------------
> mm/pgtable-generic.c | 5 -
> mm/rmap.c | 39 +++++++---
> mm/truncate.c | 43 +++++------
> 9 files changed, 266 insertions(+), 131 deletions(-)
>
> Hugh