Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4937514pxj; Wed, 9 Jun 2021 05:42:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8ibt3quthMkKsKHkDgD/IvBQEzse2jqYruMOblNl2VhHohqnefdA8c+dKn2LLcIC604lN X-Received: by 2002:a17:907:2059:: with SMTP id pg25mr26866357ejb.130.1623242566928; Wed, 09 Jun 2021 05:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623242566; cv=none; d=google.com; s=arc-20160816; b=lQ+stSxrRG4oAxjjrwQMaWfP1pZyxPQ8QHiS5FwnDxH5HsJJGizzP+ux/xthfF6SAU +2kTRXlEz8t/6jqJvfEIq97lcYZ6NSx+mPh/fju8GZ6LlqhzCM+Bk/PdfmQ9uzsgmI67 vIsUep04RB0RL25bOizy7fWEfHNv0HQ0xNA2dORNFRx8d7xKkrWzDncp121w3vmDLwTA PEMIqf+lWEPYci2i7E4wGKKpKDSs+d0+uiV0KI4J1M2XthLDRQClWFI5g0anYZAF2wZE jW4rKyPNc61O0+tbXVvVHvQVba0m9gGumSn35IrVHlEd/78/4YPmwVMDbjHPwUOP6s40 AmCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:subject:to:from:date :dkim-signature; bh=/lR22JItVYcAEN4FGPywBWFlZb0TSLLrPjU/wXDo3Sc=; b=e0IvBZJwX/MNWWH7wr6Bb/FAJIVK+mHs58+cwCG6VVGYtyQgHjt0PsK7SES/Xr9Xch N1Mz5Bhj/2SR3cpUzG/bv5pd/M9XT6oHRo0pbaQs2tEMUqYBSVVs1EIIA5Sud1HcOYMO SCbPUXzV9BAt1iPhkMzz7hH7KQj4AQKu5wo59wtiSA6TVoSprUfVZYjSj1CjYhJXAUFD MoEyU/Fmtiai6UsV9SsnpSz6pVrn90nNnoLO8iUDrlPp0fbpM4CHIwyBx3gW5wakYOeE EuHZRF02Ht6oB3bbTSWASIcG8qd2XsBX9MHtohOhVx8O5vrT5d3r6sUbi+Nhnk475Jvt GcQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cLjfvOzs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si2578809edy.93.2021.06.09.05.42.23; Wed, 09 Jun 2021 05:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cLjfvOzs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbhFIEGl (ORCPT + 99 others); Wed, 9 Jun 2021 00:06:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbhFIEGl (ORCPT ); Wed, 9 Jun 2021 00:06:41 -0400 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D8A2C061574 for ; Tue, 8 Jun 2021 21:04:36 -0700 (PDT) Received: by mail-ot1-x334.google.com with SMTP id 69-20020a9d0a4b0000b02902ed42f141e1so22657490otg.2 for ; Tue, 08 Jun 2021 21:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:subject:message-id:mime-version; bh=/lR22JItVYcAEN4FGPywBWFlZb0TSLLrPjU/wXDo3Sc=; b=cLjfvOzsqwPnUo85ps38fW2QmjSJx3C3ai2plcCcR6PZly/cXSPR3xmQbovmx/q4rz YCuxjjReconGotHIXIzTaW9r7b5j781u7S2mipjVC1uXtNgmCJ08kJ7hjaVOFTd0SPJW Uo1k5x1kT6wAlDedXrur+kV99lEhCkmobKX/dXfNmxQeGfk6K3wObg+j6cQzw2uuT5Zw AHrkLwd/WrCr3SlW4iISlnIbd6Uq8BVOkqVVu1nTEevMzsdHMyEmhVNRe+UnnTnxKp2g YpqxVhcs0VcMLaa7aRSJkCc4TDtrjWQlQKCc1EmWiYpaxRmYBxiyctDPZD3OS0LXa6rc J/5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version; bh=/lR22JItVYcAEN4FGPywBWFlZb0TSLLrPjU/wXDo3Sc=; b=bkkQolzlhzDjhmpEcveD7ZJkULCa6T8eB4rW8HsXuCwhOCbtoxworsVs5MigdHJoWM gRmWmYmwDN6+vc9szrUP0C5eJ4HW3J3LDYvcVSbVDeho6Q/CUGV2ItAqR3cywuBn8xWN HUZy2ebNYLmMXWyOu0XLBfP2eiyMcBptVvJfuTuVYQO2T+V+e9mYc1+rrT+cziT+hvmx VbxmPW0WemjnFgxAi1R3jRQqWD6qgduj9SfHZtE0PhETDvwbQaArxkLUGYtdNG5Y5XQ5 5euZwQ7B5ucI7miEQ5hmvL+H65ZhuJVrPnGNnwobZ8sOAtnnmzHM7C9WT7RGsNPgEvl8 bgGQ== X-Gm-Message-State: AOAM532FTVIQPRXFX38ynDo7YRNRvOnTCybEJo4gZ920bYbV7H3tLlG0 8WXuqZJwJLtu5b/Lmi51xTHsKpZlYBFGBQ== X-Received: by 2002:a05:6830:124d:: with SMTP id s13mr18901511otp.241.1623211475859; Tue, 08 Jun 2021 21:04:35 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id d12sm3111548otf.65.2021.06.08.21.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 21:04:35 -0700 (PDT) Date: Tue, 8 Jun 2021 21:04:32 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 00/10] mm/thp: fix THP splitting unmap BUGs and related (fwd) Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ---------- Forwarded message ---------- Date: Tue, 8 Jun 2021 20:57:34 -0700 (PDT) From: Hugh Dickins To: Andrew Morton Cc: Hugh Dickins , Kirill A. Shutemov , Yang Shi , Wang Yugui , Matthew Wilcox , Naoya Horiguchi , Alistair Popple , Ralph Campbell , Zi Yan , Miaohe Lin , Minchan Kim , Jue Wang , Peter Xu , Jan Kara , Shakeel Butt , Oscar Salvador 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@e16-tech.com/ 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