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 B3D1EC07E95 for ; Wed, 7 Jul 2021 21:26:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4885861C94 for ; Wed, 7 Jul 2021 21:26:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4885861C94 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 F002C6B0011; Wed, 7 Jul 2021 17:26:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB0AD6B005D; Wed, 7 Jul 2021 17:26:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5CE06B006C; Wed, 7 Jul 2021 17:26:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id B31CF6B0011 for ; Wed, 7 Jul 2021 17:26:50 -0400 (EDT) Received: from smtpin39.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 14C0418017AD6 for ; Wed, 7 Jul 2021 21:26:50 +0000 (UTC) X-FDA: 78337076580.39.F6C258F Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by imf18.hostedemail.com (Postfix) with ESMTP id 3EAF8400208E for ; Wed, 7 Jul 2021 21:26:49 +0000 (UTC) Received: by mail-ed1-f46.google.com with SMTP id eb14so5413161edb.0 for ; Wed, 07 Jul 2021 14:26:48 -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=M5yuPn7bjyzZ0FHn2GkilfPCZhHanR6XcSlMUG83h9I=; b=QUIveI2p1y7h+sAn0j62P3Mdoa7rUpgwg0tx/L7fmh0k1BebfugcI+3e3pilJ03QnQ ziJB1UYK+Ig3kNejFe7Mg0ztrn8VjMRhxCmejEp+LRSy1PViVjShyvqCdPGQNSEmcOd5 FvISft4acfszDveneptbTK96ovLs8VjJKgy1/mHYgJd7wDfxl04U5dNcIhatj0A6Dc22 1eE44wWJho+1czHxoWsLAmxRylIK+LbIDLvsSmm5APuAkwjf/P7042H+2VlZ7/ESZJiY 63DKMEeAfKkUGhRbbJdGSOkQHvZxTp/6AAQ2l2afgX4xAEfliiQ8no1xtyYC7dGBJfFY RuMQ== 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=M5yuPn7bjyzZ0FHn2GkilfPCZhHanR6XcSlMUG83h9I=; b=bQmcjWH/SyroFdxSnZGuIanyzouxrBMG4TUqogHXDgr/th0T5RoHACNbW/mLsBGDHR T21bLe053ASdyU5uzKJB46jYhf1oM7ZQf7FJ+Xl/KW/k16SCh0jIOM0e/gGLkfrr9JQw tUwEE/pojTXzA9//h1wvjl5QQSRRfxDLG0LHhcvUk5OV+EgsLcUv5Dkn9rb5+n8FLL3g eWIpREiOMcQgWKIiqn+VI5vrClsLWWgnYjzP2LEgz6fAb6lOxWCqy9K+wcMgAIVvY36y UdrZnQ1/HkqcZSAUS2PtUFrIzWJ66VZSO+VPEDtUzAsWZLq63W/+F9Xosvze5ux5iHlh a79Q== X-Gm-Message-State: AOAM532F7wkGQ5fjopvyJQqc6HzgDUezdsSzg1XhF7htAPIQwBszbPvl ABdSXlDieiduRhIk4g/na5raomk3VcI81ZNuzSo= X-Google-Smtp-Source: ABdhPJyLvPHMlKTmjU+EYvKxuQDmxiR7Lep0nFMVKU3sFZG5gywIAHf+hHgQXJpt0biOQA5ryOqCpAA0mkLAh4MCcvI= X-Received: by 2002:a50:cdcb:: with SMTP id h11mr33350232edj.366.1625693207943; Wed, 07 Jul 2021 14:26:47 -0700 (PDT) MIME-Version: 1.0 References: <563ce5b2-7a44-5b4d-1dfd-59a0e65932a9@google.com> In-Reply-To: <563ce5b2-7a44-5b4d-1dfd-59a0e65932a9@google.com> From: Yang Shi Date: Wed, 7 Jul 2021 14:26:36 -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" X-Rspam-User: nil Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=QUIveI2p; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.46 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Stat-Signature: rx8sw9z95fudugqb5c3c566uiojfk1re X-Rspamd-Queue-Id: 3EAF8400208E X-Rspamd-Server: rspam01 X-HE-Tag: 1625693209-966880 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 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. > 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 >