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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22AB9C433FE for ; Mon, 7 Mar 2022 12:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238056AbiCGMLH (ORCPT ); Mon, 7 Mar 2022 07:11:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233149AbiCGMLE (ORCPT ); Mon, 7 Mar 2022 07:11:04 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49E8C7B553; Mon, 7 Mar 2022 04:10:10 -0800 (PST) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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