Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5144530pxj; Wed, 9 Jun 2021 10:07:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyedGYWpRaOWzcb5dJLEYeUJtkdaMCrt1Uh/mty0oqCaxET2xnCKVQS1ZIwI/ZFbbfUv9Gi X-Received: by 2002:aa7:ce86:: with SMTP id y6mr415133edv.309.1623258449540; Wed, 09 Jun 2021 10:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623258449; cv=none; d=google.com; s=arc-20160816; b=WvbI0Ow5Ccn4rEDOyTXwG7sNs0aKCKW2WoCtSKZ9FDq0Cjfbk3EXeTJRdTyLzJpmDK riCYC3u2QxmQja8E6O4I0wEIJLQm/r9/2wbgxafQf7etTHv+Ab50cxVomUY6CP98x13f V7V/bQ82EreKWdCAglBuLhqR8/85tBoFk0Fwfm+DXASIdbqqTMrxQgGMBH9KaZKrhZTY M8MSeo2dhwtGOgBZoDbW6EG74ZA9J1zcclOAaCMZOnotYyjaBe239c0IVV2WBCM+pcJc I+LCcxW+TGJMUJVqDpw2MZWjEf3kYPYPrRo+QM8AuKsItMmUN6UsSqEPcnKI4oQ4N65x 5yMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=PCG4uUwW8wS6xmpuPwkiV4oLkvnmo78CTRIwxQBRKgY=; b=0FcgTvfbvPmx/U5qB+npH5BiT6rdwFjLgfLUcaljVnBuRljwFkjTMNJZJVzOgwkvSL klLrz5lNVo4mgOUIc+ShQtULgXLf146Aeq/xxj9n2gQxGiDkXCcl2aTvrW10MmFVbqnD 73jVw5r5WuvF5jVGNgI0hOHJArPH2Ps1ocYT1i3Dbsl3SMwA85wL8JQaUAzqFijP3tM8 BoXxASGP5LTw2ELwD0h2rmcZat9okslVxLm6ZXkwQ72KmGmOAAl9RLWyPlzliCAEbIaK Slhh5MuJKwbTejUxiNKBUeyc9058PhQsxgeSVa1aTcSwHSU60B79NumD4opKY+/v4HIu wztw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ISnNRpCi; 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 j10si199536edw.560.2021.06.09.10.07.06; Wed, 09 Jun 2021 10:07:29 -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=ISnNRpCi; 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 S231494AbhFIEa7 (ORCPT + 99 others); Wed, 9 Jun 2021 00:30:59 -0400 Received: from mail-qk1-f170.google.com ([209.85.222.170]:33354 "EHLO mail-qk1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbhFIEa6 (ORCPT ); Wed, 9 Jun 2021 00:30:58 -0400 Received: by mail-qk1-f170.google.com with SMTP id k4so22573478qkd.0 for ; Tue, 08 Jun 2021 21:28: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=o6aKgYFNvy+m0Cd0z5VvQCnay7DFs1pKyMys9ZLaF9kNquZ+7rih7uB5gUpgsEoUxv bh6pt1hfqb4OKEzqWdoRcNDY4XqU4fT9aF5r7HxORiY5CC6oj7lM+626WDih1dUu6mHj 73L2m/z3m5OfRdKT1sX5pT289ioby7Q57PPWjrCPZTfAAfY9ssO4QUQNG6RaumoVKnEG ptyWBo2Fl7upeCc1djt+krjzDBlz0t5QIJwx1rIibsxmbREj+vnmpvV9DHSsZaCO9f7H drtuKNQbtd8dO6R0LJoCI8jGgAFPqvzxv64TEy0cFyrNS6cQ0AisD0+eArnkBj5y7AdF wAzg== X-Gm-Message-State: AOAM532GBrswRP17+R1n4vzcjqOOmG37tb5Tj/zLKNVIR8ECv36Rl69p OLaZK6Km63Zlm7DxTELzTz22JA== 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 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 { -- 2.26.2