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 36737C433EF for ; Thu, 10 Mar 2022 09:01:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240580AbiCJJCl (ORCPT ); Thu, 10 Mar 2022 04:02:41 -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: 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