Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1668381pxp; Thu, 10 Mar 2022 09:42:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4egO8k4xctCorDhFsFaPA4+iesGJFNkWW/YPwyIfxK8h6wYbVRM7QN19gv+JGAatMr1T0 X-Received: by 2002:aa7:cd53:0:b0:415:f5db:5d53 with SMTP id v19-20020aa7cd53000000b00415f5db5d53mr5333474edw.399.1646934162467; Thu, 10 Mar 2022 09:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646934162; cv=none; d=google.com; s=arc-20160816; b=RVboLMNaC/7vrNUHD3kMMYh8OM62dt8GAND18Vnr7HxUss/KJlXunbHJCo1/3JzMg8 JLs/hqh3Ym9UBAJC/cMEOYqwf1pUjNrBbp/lf2sqzJssJtpI3LCE2dS8SdkmAhrGU1Rq NLkjC8qNir7aUo8jwn16ONaQPwIYpmnFjjbzE7P9dB0AMw2c4f08gitBvybPkCUsFNzF TV9Age9mD7hCv9gmESCdOGJY/Rd2savjS60wvB7HChvmDTdkH4MA9tFLm+mz+O4tBt1S Ep/T0mrKTfqzQz4lDkILiyTEP3rLgbEBghQXS5uKjO8WqckJ1/t+em6J2Rn7eAOGyNip eUwg== 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=Q3wfW/I8v/C/DQl/WQwulFGFmSYU2P2jDmQ6F/WBzy8=; b=RCuJU1JAGfEkhpBfURuboGC9kPfKfqwt2F81g9A5R2YJgHiBuDB/NG2VxOLL+Q34Jd 43YE8KDB4iRqrsAAgERsuMEa5lgRvkpzvU7T1S7pukCMX162/fKjk9JAmr4GiHrKEZqq rXmzQfpkh8hKx7/DgLzEIP0uLgFNAPKqSL/8I3jmyCBkuFvsB5qo598ZerUDN2kybIxG K/Ccxc+eVHC4CVm9mTU93lmbtiI3INUHYXAgseuWcqR0hsu6Rloi0Fl0zWXQL9Ll1a3g YFCTqZtYOr1vtrcFith4xYi7Ovf9kd3KiVJ7Jr5kajRY+24qBgt7wtx+m5G83S5un974 MBdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=C6pJrPId; 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 r9-20020a05640251c900b00415c51ed3casi3809404edd.397.2022.03.10.09.42.15; Thu, 10 Mar 2022 09:42:42 -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=C6pJrPId; 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 S229891AbiCJJCj (ORCPT + 99 others); Thu, 10 Mar 2022 04:02:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240587AbiCJJCd (ORCPT ); Thu, 10 Mar 2022 04:02:33 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F45113775F; Thu, 10 Mar 2022 01:01:31 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E133A210EA; Thu, 10 Mar 2022 09:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646902889; 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=Q3wfW/I8v/C/DQl/WQwulFGFmSYU2P2jDmQ6F/WBzy8=; b=C6pJrPIdNjnZabS0MDoagV/JT+fcPh5THqLCDy9dKdrcCEUqiyRw307oCyt3KBss+IrHCJ UWfBqTxQR8wErGy4vm0BHZl4yrlU+d8g5qUjKycgAu/gZmKWgAJBwvFJZHkBIyIhHabaTs 5X48vjJly6bkuaKodJ1PV/1KYnGv88Q= 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 67AEFA3B89; Thu, 10 Mar 2022 09:01:29 +0000 (UTC) Date: Thu, 10 Mar 2022 10:01:28 +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 Mon 07-03-22 13:10:08, Michal Hocko wrote: > 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 Do you plan to send an official patch? -- Michal Hocko SUSE Labs