Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp618376pxj; Thu, 3 Jun 2021 15:14:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIM24Gy1QntDCtHkPcV5LYDeZMLkjG1It/glY2N06OU5j8DiKJJ5zu5DzCYb53Qc+Go9ej X-Received: by 2002:a17:906:2854:: with SMTP id s20mr1255567ejc.335.1622758440928; Thu, 03 Jun 2021 15:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622758440; cv=none; d=google.com; s=arc-20160816; b=Eluie0/sArpfCNvH+TKEeaGjhbpMsXbbIk0IkqJBldYOeTFcWuirh6YRN5SkRmjuEg vk9NO81axCr52eqyZ7dGC9/0uZENIJ7vEy2ttfZIFx+tpUD7n5n79wmlhnkGx/tJqGj8 z0iAziRqHyFQG+qGlp7E7PlnkqEhETeDJ2ONG6O1JoUYKZrOBP8+yBO18QlZWCDk4HRr 1abVT4Q9WCJZ952PjJQ+n97LF5CkfUBorm7n1O2oXOdKmQHNs38sAf6Q3m8wmfS2rZDX eq1Jm8QHml+qNF/bjaMM/DZ7iF7AAifHw+DbBTHEVN7VcOk6txfzgmRcMUqtUjdu0OAC dOQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=xzfzoB78UopFehP2rZuPNY6pMK6KSVtNl9pjPqUQdkg=; b=n3flZNIevANT4gzuJB1R3pcJ+oFQo7lW4G+DzbIiBQbKIpeYNqozH9dE56Kw3D4k0H 1VHsPdqYFxvv1dqVOcLirMIdJAGGQkY4FvJNX+bdIjar3RymRrXi9XevgO1Zl5AHj1qh cyQzmabeMaDhOfnuRtMemaS2iD3xe1dAzfiT0xO+XzJ8IQu0NnhnAWob/TfUEmxoZO6O COWizBqJ6MELdxbG3CK4wVX3JJuJL0HipLNZHf8UPF+iu4eo9svs4TlONuwEdCU6e6ig R9d8LjGafmx/MseDYCvWSLsIT1KBl6f5MSeEHhto/5cH0svp/Fsvt+TWtmyEVVohQ3u+ NJ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OXddwIVV; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si3047916ejt.614.2021.06.03.15.13.34; Thu, 03 Jun 2021 15:14:00 -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=@gmail.com header.s=20161025 header.b=OXddwIVV; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbhFCWL0 (ORCPT + 99 others); Thu, 3 Jun 2021 18:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhFCWLZ (ORCPT ); Thu, 3 Jun 2021 18:11:25 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07710C06174A for ; Thu, 3 Jun 2021 15:09:30 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id l1so11475484ejb.6 for ; Thu, 03 Jun 2021 15:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xzfzoB78UopFehP2rZuPNY6pMK6KSVtNl9pjPqUQdkg=; b=OXddwIVVqk7mMnbvUmy/B4vinnZoldRQPMmjX0oGBP4JWDb74m2zdXEvW/MiQqbJ5B MYfQ9M76M6Ih+vqYWZnBvTdP4DhooLQ8/v7XnkSBhUTlN7UKKw+0CKsr6tpqU2sAnYjV NCv2RRzp0+4h9cVbfCJkOS+NmFEHGftO/QWi/FKP/r6BPiuV7k2Z6PgUgZkj/4IHaRCc KDNjLToXSAjAkKIYnBO7YYgW9sYdKCncFIY6Hz0yWhdnDsh0fpT611aT58zYII6ArLUN hHpzUPg2uUHNwtm0UlhJXvZWjy3PFtyNUUBB688zGQ8EEtn4ZPSZrsaB+3HSUGZd7VC0 R9vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xzfzoB78UopFehP2rZuPNY6pMK6KSVtNl9pjPqUQdkg=; b=KCvK4g+QQdcHcMH/KqcVMxFEZoD0vameXnN1EBik06gvqIA/yL9n+jlpQowtu8Gc9Z Cucl2+Jtf4CxyVmVn5iqXhH+sQYXpKlDpHZTDBByy9CJsrOEqmJ/Bkk3UmGTjYq6/5Wd LxR1UQJT9KfrIbUKeEwlAnzSUuhvoU+NuCYGNnxGIX3Fj2paEGlEMFQg1I3GJgT2SoDa LKpIdjrqb/MYIZS9B+jpn7DJeDMZcWWCDn4YueB32ufuxeXbu6bZubbhDc6ylYZl/xyG IKCsO70GM9ni06qDXgE7btqpEVKksRRhVhXgNqnxtk2HejuFhLUdSv4wc35txiNjMN5U x2/g== X-Gm-Message-State: AOAM530DAUVSjtwU0dVguM/HNSRDkWvBYo5sBNRQalqj6pMEsZIRmeLg yFSW52k/onlOtaf23LNvVkseMZ20H1KdSExnNos= X-Received: by 2002:a17:906:3912:: with SMTP id f18mr1235862eje.161.1622758168683; Thu, 03 Jun 2021 15:09:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yang Shi Date: Thu, 3 Jun 2021 15:09:17 -0700 Message-ID: Subject: Re: [PATCH 7/7] mm/thp: remap_page() is only needed on anonymous THP To: Hugh Dickins Cc: Andrew Morton , "Kirill A. Shutemov" , Wang Yugui , Matthew Wilcox , Naoya Horiguchi , Alistair Popple , Ralph Campbell , Zi Yan , Miaohe Lin , Minchan Kim , Jue Wang , Peter Xu , Jan Kara , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 1, 2021 at 2:17 PM Hugh Dickins wrote: > > 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 > --- > mm/huge_memory.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 305f709a7aca..e4a83e310452 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -2354,6 +2354,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; > > @@ -2368,6 +2369,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.32.0.rc0.204.g9fa02ecfa5-goog >