From patchwork Wed Jun 9 04:04:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 12308823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CF07C47095 for ; Wed, 9 Jun 2021 04:04:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 995DC6124C for ; Wed, 9 Jun 2021 04:04:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 995DC6124C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id ECC706B0036; Wed, 9 Jun 2021 00:04:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E56266B006E; Wed, 9 Jun 2021 00:04:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCF586B0070; Wed, 9 Jun 2021 00:04:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 96EDC6B0036 for ; Wed, 9 Jun 2021 00:04:37 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 30397181AEF10 for ; Wed, 9 Jun 2021 04:04:37 +0000 (UTC) X-FDA: 78232842996.01.9B869B5 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) by imf21.hostedemail.com (Postfix) with ESMTP id CABF5E000255 for ; Wed, 9 Jun 2021 04:04:31 +0000 (UTC) Received: by mail-ot1-f50.google.com with SMTP id w23-20020a9d5a970000b02903d0ef989477so18219276oth.9 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=h755jZVoww+z4uBmRksjNPkurgXllbruRMqHgx4bsJW3MPD2kMrHCGHqKtU12rdUKB NwDZx6wSJxGgWHPy6fkeP8/spt3NbmMNeuxzUzUMUvnibtaFsG2wnhgySb5UOvzeK95K hiCuvB6zIQZ6Fw/nsSZGA6zwYcCro6+m/poc6frCHt1S73Jr6ZGxfXYM+rnoRyy5NL3F fF52IWIX9RdLaOf7yNyGlbF9JUebvA1AU91zRGZOtnB7xPLFBja5/HOaVRqHy3nCrV5Z FfzdbcedZjGqOOkwc5VXqgKRNS97nCWm0i9AGYz55f14rTZ/KAJ9XbzodFhwCGEd2+B6 WoYw== X-Gm-Message-State: AOAM531FFNUM3viUUHMALRyxf++XxUULOcc97jIhvR8j8AXIN8z73OyA L95qM1pUDczCUS5DwH21URamc5siOJA6kg== X-Google-Smtp-Source: ABdhPJwXpCLJvZM3XclfhJyjulo0PNbvexlw2QhxVMK666BQq4urUt+/r2eruygRWKvJZyRUUkozVg== 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 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: CABF5E000255 X-Stat-Signature: 1we8x65xupb1d4cdbeagmjb5z8omy39e Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=cLjfvOzs; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of hughd@google.com designates 209.85.210.50 as permitted sender) smtp.mailfrom=hughd@google.com X-HE-Tag: 1623211471-479841 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: ---------- 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