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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 813C7C433EF for ; Mon, 7 Mar 2022 12:10:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F39338D0002; Mon, 7 Mar 2022 07:10:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE8658D0001; Mon, 7 Mar 2022 07:10:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD84F8D0002; Mon, 7 Mar 2022 07:10:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id C9EDC8D0001 for ; Mon, 7 Mar 2022 07:10:10 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 99EEC23E48 for ; Mon, 7 Mar 2022 12:10:10 +0000 (UTC) X-FDA: 79217472180.02.03F5233 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf31.hostedemail.com (Postfix) with ESMTP id 1F5CF20011 for ; Mon, 7 Mar 2022 12:10:09 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B528E210ED; Mon, 7 Mar 2022 12:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646655008; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Dkb4ct3SBLHYHDLXIznK3mCTy5dmP6jO5tiTvWElxZI=; b=WWwAUv6gva+yJu5ZRvAXYMvY/1LnxcAfv31J5iAQvncwwz+lDi6Fi9x+aKj4Kr7QvvdlqU J5KaPs9OnoVW0kSs92Ctqj49e9Rf2Qkc5L9hdXyOBuxGRps8xpbcPG6Ek7nOZE8qLuBqUA nZu1D0kmrrBEmDWbQ7NLAq4oUXucWG4= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 2EA08A3B81; Mon, 7 Mar 2022 12:10:08 +0000 (UTC) Date: Mon, 7 Mar 2022 13:10:05 +0100 From: Michal Hocko To: Yu Zhao Cc: Minchan Kim , Ivan Teterevkov , Andrew Morton , Linux-MM , linux-kernel , linux-api@vger.kernel.org, Johannes Weiner , Tim Murray , Joel Fernandes , Suren Baghdasaryan , dancol@google.com, Shakeel Butt , sonnyrao@google.com, oleksandr@redhat.com, Hillf Danton , lizeb@google.com, Dave Hansen , "Kirill A . Shutemov" Subject: Re: Regression of madvise(MADV_COLD) on shmem? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 1F5CF20011 X-Stat-Signature: j45ypkoghiu7eeodsrnpqwkb1pw3bdrk X-Rspam-User: Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=WWwAUv6g; spf=pass (imf31.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam07 X-HE-Tag: 1646655009-760911 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 Sat 05-03-22 02:17:37, Yu Zhao wrote: [...] > diff --git a/mm/swap.c b/mm/swap.c > index bcf3ac288b56..7fd99f037ca7 100644 > --- a/mm/swap.c > +++ b/mm/swap.c > @@ -563,7 +559,7 @@ static void lru_deactivate_file_fn(struct page > *page, struct lruvec *lruvec) > > static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec) > { > - if (PageActive(page) && !PageUnevictable(page)) { > + if (!PageUnevictable(page)) { > int nr_pages = thp_nr_pages(page); > > del_page_from_lru_list(page, lruvec); > @@ -677,7 +673,7 @@ void deactivate_file_page(struct page *page) > */ > void deactivate_page(struct page *page) > { > - if (PageLRU(page) && PageActive(page) && !PageUnevictable(page)) { > + if (PageLRU(page) && !PageUnevictable(page)) { > struct pagevec *pvec; > > local_lock(&lru_pvecs.lock); > > I'll leave it to Minchan to decide whether this is worth fixing, > together with this one: There doesn't seem to be any dependency on the PageActive anymore. I do remember we have relied on the PageActive to move from the active list to the inactive. This is not the case anymore but I am wondering whether above is really sufficient. If you are deactivating an inactive page then I would expect you want to move that page in the LRU as well. In other words don't you want if (page_active) add_page_to_lru_list else add_page_to_lru_list_tail -- Michal Hocko SUSE Labs