From patchwork Tue Jun 1 21:03:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 12292225 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=-19.8 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_AGENT_SANE_1, 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 B0AA0C4708F for ; Tue, 1 Jun 2021 21:03:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3FDD7613B9 for ; Tue, 1 Jun 2021 21:03:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FDD7613B9 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 936AA6B006C; Tue, 1 Jun 2021 17:03:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E6E46B006E; Tue, 1 Jun 2021 17:03:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 760126B0070; Tue, 1 Jun 2021 17:03:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id 4675D6B006C for ; Tue, 1 Jun 2021 17:03:45 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DF7A0B9F4 for ; Tue, 1 Jun 2021 21:03:44 +0000 (UTC) X-FDA: 78206381568.34.36CDBB3 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) by imf10.hostedemail.com (Postfix) with ESMTP id B8D1E4202A24 for ; Tue, 1 Jun 2021 21:03:32 +0000 (UTC) Received: by mail-oi1-f181.google.com with SMTP id s19so687827oic.7 for ; Tue, 01 Jun 2021 14:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:user-agent:mime-version; bh=l/l+v5X+oLRJBHDUXRGrjTZKpv5YVsX+2isDeYmnVg4=; b=HrFwY4QYFqbMigF5BpUSwMk4+GZcIcMT7Mtfaqk4R/yAp78dWUz1NA9ybUroyCv7jY 18fxx93VRlGq4kX7zjZ7Dlkq6mVpZJmwfk0pMIZXqg8EDMMZBhxUJPW2pxJOqYASszLI 9rVD3LQFJvsP0kSZRLe2eFoRV+ksRau7QszbY3ET+JNpxltMovrQSDT3ARKEL4UWeRMt CSnoY2ZE11R5GanhfLciPU1hmhTNFlqtshIZpiZFQNqvedELzuOUiVVtgIVBPIrzJ8Rm Qpm2oLIsH/X5MPA980hp4OlHuvy6NKfTfhcBInY5fsUk6whYTrlc6+pPnSEV4/nfavO+ B43Q== 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:cc:subject:message-id:user-agent :mime-version; bh=l/l+v5X+oLRJBHDUXRGrjTZKpv5YVsX+2isDeYmnVg4=; b=CwcJX5ZLojsPjKB5llYLZlQWaXlduROZeqrT1roGjyjghzoLWVsAtQvwPgWLKSJ+4W ExLWz5XFO2gGcX/e4FCWUOnEWJg4UNbYi/JBNs35AQaFOqjwhbakIEeGsmIVqPCXFDzM 1BN12L4yBPilRBDaxfwQWaG6iVpw1kVCmL098jSLWrCfpep7MTPR6DNlIEJ2MWKGuPha glGLDxobZAZLLtqBfqOY7ncgvd2VMIit/mzzr2DuVUACQdQVmSDYNiGrOFxDb6Q8c8FF xNbWTJFgNAtyCbW+ZJdW4/JPtNHMR2dD1OyDb+T8pD2pQRpVphN7btlxpOcKvQmMkr8/ mtsw== X-Gm-Message-State: AOAM531ouzOD98kGkFYdygnaE8Fn/3jGe8pBXPV2Am4kQ2u32J057/6F sKHRQLcqA198WraymVLz2P5vTA== X-Google-Smtp-Source: ABdhPJx3CVgQjugIPj4M0vJd5OW1nmLCCa4/Os/1sEr5qKc1o6SZm+6H0i2O9eCoQ1wTtPY+KlMgdA== X-Received: by 2002:a05:6808:a87:: with SMTP id q7mr19559940oij.38.1622581423647; Tue, 01 Jun 2021 14:03:43 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id l131sm3609558oia.0.2021.06.01.14.03.42 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Tue, 01 Jun 2021 14:03:43 -0700 (PDT) Date: Tue, 1 Jun 2021 14:03:30 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Andrew Morton cc: "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 , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/7] mm/thp: fix THP splitting unmap BUGs and related Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=HrFwY4QY; spf=pass (imf10.hostedemail.com: domain of hughd@google.com designates 209.85.167.181 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B8D1E4202A24 X-Stat-Signature: 89utrt7uk3s44u31u96nipuh1h5nkdmf X-HE-Tag: 1622581412-533530 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: 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@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, 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. 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