From patchwork Wed Jun 9 04:27:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 12308843 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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,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 81630C47095 for ; Wed, 9 Jun 2021 04:27:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 14107601FC for ; Wed, 9 Jun 2021 04:27:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14107601FC 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 9F7DC6B0036; Wed, 9 Jun 2021 00:27:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A7DA6B006E; Wed, 9 Jun 2021 00:27:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FB016B0070; Wed, 9 Jun 2021 00:27:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 4AE9B6B0036 for ; Wed, 9 Jun 2021 00:27:50 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E7801A8F6 for ; Wed, 9 Jun 2021 04:27:49 +0000 (UTC) X-FDA: 78232902258.35.58FFA3A Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf09.hostedemail.com (Postfix) with ESMTP id 7FA5A6000141 for ; Wed, 9 Jun 2021 04:27:47 +0000 (UTC) Received: by mail-qk1-f175.google.com with SMTP id c124so22519957qkd.8 for ; Tue, 08 Jun 2021 21:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=PCG4uUwW8wS6xmpuPwkiV4oLkvnmo78CTRIwxQBRKgY=; b=ISnNRpCieQkW3oz7o/YjHabNZ0xWqccqSPmHG2RGMzDEDOX/VY1vdWkev1zuAu9bf4 CLBMxrS/rDZwTQBTqOikREGr5+eRpWpzswMhSU2FKiuUohrvuxpQQbpkKqLgnACpFngy wotrtTqMXRz2IeWNPzl82lj2T5/EugCK8bQ1l8yifOMTdDOtYr5PVIA3A6gIe1EonP0n jIdGAnfNvldffzBciY3ibTHeza+5sC+rNLcfxLUQ+8oJzpa+8/C30RtBUeju8jOv4WAl 3Sy5Kbu9hdOcMeLwP1ffxx4YX8lSWJ5uBZ4BzmkwrcffJTiGoA1jYlNtz8L5lTxQnLNR UkWg== 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:in-reply-to:message-id :references:mime-version; bh=PCG4uUwW8wS6xmpuPwkiV4oLkvnmo78CTRIwxQBRKgY=; b=BwyOr3u6QaPSDAaagQmVMjh2sw3VTnLOnZJekG1bwmic1YI736ZKhJKplw/2/rl0cT hy0CMmM/LKCzsQ8tpjYVG6EDebcTXNpiT2oUz00ZMjNa+/xvWaBe4C7fFdUTi62vvjOt SoBv6GL233mfYLlqOK8LBEhvq5CJ6yl9KAbU1xM2a60KUID36zeQiENQJjHd97xhhaTG p6QO11CNaNDnjNtYxQRS4jMBGkg/T/gMdCFlKz95kc+t1j3Atj4enU7YcGWOnRWdogAr KMMuLt2IxzZdaJtBXtMaE3w4xQtQ26x3Xi08/1Isc/GDxMZdNcQUIMKbWHM9jKVeAXwv 1mMA== X-Gm-Message-State: AOAM530L14K9/UqAhfRXFZ9vaQLHvY2GfKcM4luDiuD3C5vd/zDzSdDs w2wnP/0fZMAQ6Fya/lAc8rv9ng== X-Google-Smtp-Source: ABdhPJxXZMNVnAh0LFgldc9dyfNSXHSfAHtXSYWJqsucG866iZ2oHmbpoSnB8lX2SgUmBPKcL7ZXYA== X-Received: by 2002:a37:911:: with SMTP id 17mr22703936qkj.436.1623212868622; Tue, 08 Jun 2021 21:27:48 -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 h4sm12175706qti.0.2021.06.08.21.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 21:27:48 -0700 (PDT) Date: Tue, 8 Jun 2021 21:27:45 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils 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 , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 09/10] mm/thp: remap_page() is only needed on anonymous THP In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 7FA5A6000141 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=ISnNRpCi; spf=pass (imf09.hostedemail.com: domain of hughd@google.com designates 209.85.222.175 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: 1co4wy8qkxt5tj46eqd819g84f6opu9j X-HE-Tag: 1623212867-250835 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: THP splitting's unmap_page() only sets TTU_SPLIT_FREEZE when PageAnon, and migration entries are only inserted when TTU_MIGRATION (unused here) or TTU_SPLIT_FREEZE is set: so it's just a waste of time for remap_page() to search for migration entries to remove when !PageAnon. Fixes: baa355fd3314 ("thp: file pages support for split_huge_page()") Signed-off-by: Hugh Dickins Reviewed-by: Yang Shi Acked-by: Kirill A. Shutemov --- mm/huge_memory.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 6d2a0119fc58..319a1a078451 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2355,6 +2355,7 @@ static void unmap_page(struct page *page) VM_BUG_ON_PAGE(!PageHead(page), page); + /* If TTU_SPLIT_FREEZE is ever extended to file, update remap_page() */ if (PageAnon(page)) ttu_flags |= TTU_SPLIT_FREEZE; @@ -2366,6 +2367,10 @@ static void unmap_page(struct page *page) static void remap_page(struct page *page, unsigned int nr) { int i; + + /* If TTU_SPLIT_FREEZE is ever extended to file, remove this check */ + if (!PageAnon(page)) + return; if (PageTransHuge(page)) { remove_migration_ptes(page, page, true); } else {