Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2713631pxp; Mon, 7 Mar 2022 23:36:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxj2UBFfmDK3t5/LBiWQbMu7SfVasqn9lmCtsmgEldbF4716TcluNiP+v8tYLM4rN4hcQD3 X-Received: by 2002:a17:902:d492:b0:151:86ac:bc7b with SMTP id c18-20020a170902d49200b0015186acbc7bmr16287753plg.52.1646725000697; Mon, 07 Mar 2022 23:36:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646725000; cv=none; d=google.com; s=arc-20160816; b=xO3gATiy3oG5jzYeJGNrfQI84uZNM6xY8IAv+alcZIg/yao1c+Ci6beaLzddSNYw3X D5ICLIfgl+TZsEt10D4xGsSY67j4pl0DAuuyNwZ1P3awV6RbvASlZYVOz1DVf1Fr+ZCI IMKteRri7Fw9xbuA/vHwUbZ6PnNxP3JfOrDSBCTNcdb3N7wYMrezG1A8N9eFgipcYYmr 7OR4bOSceFueE9nOwcgH+7fZYIG5RJjOrwln4OxIyWzemJPtH/WzM/y912ft+xqzR+DU kpe7NOXXUZGDZH6R0YFDvS8Aj/TouUaIE2rMHHZBpiayE+717LcJiTJgf0xcRoRdZng8 uSUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Dkb4ct3SBLHYHDLXIznK3mCTy5dmP6jO5tiTvWElxZI=; b=oIOVyjejyoamqbRpPNM27D3qEZS/9vtxsNWBwG9jPRWn7qz1ifLA2EL2kGhbSt+3NY awZFpIjC5XHrYK73eFgKdYJXk40kHOIDnPx0Q06qn08cv5G+KymDHNSD3UFrm9p0sNqx +vqOxzU153viXiKz+5k9VMogXH1L+RO4ELGmiS7+cSvwbMvJl7O+I++mGg39tcSMgMJe NzJ+RhxffwjMDa3B/1gNvVL73rszSoiqVY0i5LiHtB/rXYwPA2g62lH8w/m9CI6LVB6Q +A8LYILeozZnqEOfS/kmO/vnlrReXn6hCvR9bZkr13gy+Lst8GSUVjWyPbBMSlLthUbK BEmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=WWwAUv6g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l73-20020a63914c000000b0037c8afc3ac2si13100760pge.370.2022.03.07.23.36.26; Mon, 07 Mar 2022 23:36:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=WWwAUv6g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237088AbiCGMLG (ORCPT + 99 others); Mon, 7 Mar 2022 07:11:06 -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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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