From mboxrd@z Thu Jan 1 00:00:00 1970 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 8E0EFC07E95 for ; Wed, 7 Jul 2021 21:29:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3D55E61C4E for ; Wed, 7 Jul 2021 21:29:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D55E61C4E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C8CD86B0011; Wed, 7 Jul 2021 17:29:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3C536B005D; Wed, 7 Jul 2021 17:29:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADCA26B006C; Wed, 7 Jul 2021 17:29:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 8315A6B0011 for ; Wed, 7 Jul 2021 17:29:20 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DC661276FC for ; Wed, 7 Jul 2021 21:29:19 +0000 (UTC) X-FDA: 78337082838.33.C967513 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by imf11.hostedemail.com (Postfix) with ESMTP id 7E1F2F000200 for ; Wed, 7 Jul 2021 21:29:19 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id nd37so5663720ejc.3 for ; Wed, 07 Jul 2021 14:29:19 -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=12ZCunrDmFOPUQ9ZiI1IP69gcpUIltI9qlCUxX4KPz8=; b=naFvC3lT1oFtlwB/+mJJsK5GhxWjIG7nRr4rLTO53iLs6UrTekTPX4oovjq9cTrc8y JroMYBygdy3CuxKXIzVNQxbQV1B5v81/y1szt9Lpnwo1yjgIXBOXZKplYbb1XO+9+Vop 1qNqP2O31UZ7u48iVPhJA4KR4e2ZbCihl+3CG8WFRvM4tt6oU3ItAk3C4DLl+MHiBqMr zFBk9AnpLF490TjCUXpKBGnpjIWErydj9rtwqiVX3U6GgpZK4apfDfVd1HMA3/2SBX1M pddrg8mRixnqLLozujvCstyyBkBOFsDK2BS99DC1butOugtdIHxE/92+ZytcAdx1JeGD B21A== 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=12ZCunrDmFOPUQ9ZiI1IP69gcpUIltI9qlCUxX4KPz8=; b=HpYChQb0hbcPblfYbPMzmysjvXQL3Sv6b2qfrZ3LStPjAkaHo4Ffwg/dkuYLwwHHDz k83W1YEPqG6OIOqWTaOUU9IkSeN3g20XA6kyY9Yoco6kpkGOXBuRvNfG/cQLBPvRAXeL fm6dSDoos3xDeCqUK8kFvaNto0DbM8hU75BTggm5fW+Xz9m9gyeEZ164+jP6k1SJN+Ml byJ0dKVmeBIUx9Y/DyqjgPfP1k17/hs29VJKPqLJOkMjxtaOGWKePjGWVTA0m1h+IyWh fK5ty13vgJL0eqvf6zA1hRDc/Bwll4yEno/mlkM/Tr8Z+Sw23B5zvp1HDjcv50JH8Hht 2G+Q== X-Gm-Message-State: AOAM531Yhjho+B3akJIrJfjW5rUu0iqRw2/95B0MGk5LPBNJxd/SUlpZ cMjKq5B6hgXf9usg2Mg6txmnl+pOrtiTpN6WjE8= X-Google-Smtp-Source: ABdhPJwzK7zZeGwvYsnJ35Avvh78YSfwpTP3you+crGsfDPe6ERxvJJO4lY/szwHfqTE/eWyy1Lro0He6t2WFbJV/m4= X-Received: by 2002:a17:907:75d2:: with SMTP id jl18mr2806442ejc.238.1625693358277; Wed, 07 Jul 2021 14:29:18 -0700 (PDT) MIME-Version: 1.0 References: <563ce5b2-7a44-5b4d-1dfd-59a0e65932a9@google.com> In-Reply-To: From: Yang Shi Date: Wed, 7 Jul 2021 14:29:06 -0700 Message-ID: Subject: Re: [PATCH 1/4] mm/rmap: fix comments left over from recent changes To: Hugh Dickins Cc: Andrew Morton , Alistair Popple , Jason Gunthorpe , Ralph Campbell , Christoph Hellwig , "Kirill A. Shutemov" , Shakeel Butt , Linux Kernel Mailing List , Linux MM Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=naFvC3lT; spf=pass (imf11.hostedemail.com: domain of shy828301@gmail.com designates 209.85.218.52 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam05 X-Stat-Signature: ab8ngjd7j8g1nemyx5go3ejwr54tr34q X-Rspamd-Queue-Id: 7E1F2F000200 X-Rspam-User: nil X-HE-Tag: 1625693359-638708 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: On Wed, Jul 7, 2021 at 2:26 PM Yang Shi wrote: > > On Wed, Jul 7, 2021 at 1:06 PM Hugh Dickins wrote: > > > > Parallel developments in mm/rmap.c have left behind some out-of-date > > comments: try_to_migrate_one() also accepts TTU_SYNC (already commented > > in try_to_migrate() itself), and try_to_migrate() returns nothing at all. > > > > TTU_SPLIT_FREEZE has just been deleted, so reword the comment about it in > > mm/huge_memory.c; and TTU_IGNORE_ACCESS was removed in 5.11, so delete > > I just realized this. Currently unmap_page() just unmaps file pages > when splitting THP. But it seems this may cause some trouble for page > cache speculative get for the below case IIUC. Am I missing something? > > CPU A CPU B > unmap_page() > ... > freeze refcount > find_get_page() -> > __page_cache_add_speculative() -> > VM_BUG_ON_PAGE(page_count(page) > == 0, page); //When CONFIG_TINY_RCU is enabled > > > The race is acceptable, I think we could replace the VM_BUG_ON to > page_ref_add_unless(), just like !CONFIG_TINY_RCU case. Please just disregard the above comment, I just found CONFIG_TINY_RCU is for UP only. Sorry for the noise. > > > > the "recently referenced" comment from try_to_unmap_one() (once upon a > > time the comment was near the removed codeblock, but they drifted apart). > > > > Signed-off-by: Hugh Dickins > > --- > > mm/huge_memory.c | 2 +- > > mm/rmap.c | 7 +------ > > 2 files changed, 2 insertions(+), 7 deletions(-) > > > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index 8b731d53e9f4..afff3ac87067 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -2331,7 +2331,7 @@ 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 unmap_page() uses try_to_migrate() on file, remove this check */ > > if (!PageAnon(page)) > > return; > > if (PageTransHuge(page)) { > > diff --git a/mm/rmap.c b/mm/rmap.c > > index 37c24672125c..746013e282c3 100644 > > --- a/mm/rmap.c > > +++ b/mm/rmap.c > > @@ -1439,8 +1439,6 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, > > while (page_vma_mapped_walk(&pvmw)) { > > /* > > * If the page is mlock()d, we cannot swap it out. > > - * If it's recently referenced (perhaps page_referenced > > - * skipped over this mm) then we should reactivate it. > > */ > > if (!(flags & TTU_IGNORE_MLOCK)) { > > if (vma->vm_flags & VM_LOCKED) { > > @@ -1687,8 +1685,7 @@ void try_to_unmap(struct page *page, enum ttu_flags flags) > > * @arg: enum ttu_flags will be passed to this argument. > > * > > * If TTU_SPLIT_HUGE_PMD is specified any PMD mappings will be split into PTEs > > - * containing migration entries. This and TTU_RMAP_LOCKED are the only supported > > - * flags. > > + * containing migration entries. > > */ > > static bool try_to_migrate_one(struct page *page, struct vm_area_struct *vma, > > unsigned long address, void *arg) > > @@ -1928,8 +1925,6 @@ static bool try_to_migrate_one(struct page *page, struct vm_area_struct *vma, > > * > > * Tries to remove all the page table entries which are mapping this page and > > * replace them with special swap entries. Caller must hold the page lock. > > - * > > - * If is successful, return true. Otherwise, false. > > */ > > void try_to_migrate(struct page *page, enum ttu_flags flags) > > { > > -- > > 2.26.2 > >