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 X-Spam-Level: X-Spam-Status: No, score=-12.1 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D3AFC43461 for ; Fri, 4 Sep 2020 03:24:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B4A16206D4 for ; Fri, 4 Sep 2020 03:24:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wCJnvNlF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4A16206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2224A6B0002; Thu, 3 Sep 2020 23:24:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D3586B0037; Thu, 3 Sep 2020 23:24:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10ED86B005C; Thu, 3 Sep 2020 23:24:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id F0D616B0002 for ; Thu, 3 Sep 2020 23:24:06 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id ACF02181AC9BF for ; Fri, 4 Sep 2020 03:24:06 +0000 (UTC) X-FDA: 77223935292.15.bomb43_0008bd2270ae Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 792D71814B0C1 for ; Fri, 4 Sep 2020 03:24:06 +0000 (UTC) X-HE-Tag: bomb43_0008bd2270ae X-Filterd-Recvd-Size: 4930 Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Fri, 4 Sep 2020 03:24:06 +0000 (UTC) Received: by mail-il1-f195.google.com with SMTP id q6so5114656ild.12 for ; Thu, 03 Sep 2020 20:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HT921qLwDCWJ1WOt3lUzk7zXUgkMbJX02GM0/k+/ko4=; b=wCJnvNlFuxsYBicG2IKm++NcKj33pxbdyD56ZVumkDIZttm7QLnglaaWa0hhHJ4cZL zbP2z3orYySWBYG2pHFzTCAwlpk2sAi48Z5nodjQuVNcwRL4yghqJBpUc3KePTx/6kKy UwmjKXECIddpzU0HlPSuM/E1saC6gPRijgLbrrL89WJzw3CbkExRREipKNpwz9TLF4eH FMDWrFUYHWrqxcTDfzcv1DEg/DVeEP+PiVpQUpJh9KfodmubgKfcArOVhUWAkBPLnAid ClRTD0KWIJ9Eeortg9ZE93vFtz6P3ZjMcben4W/L4bJqCj1FTq6BIB6s/AM+PGsko5BV nOVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HT921qLwDCWJ1WOt3lUzk7zXUgkMbJX02GM0/k+/ko4=; b=UPIURukggnbonkmWQdwuu1Y6oH+cQgA9a6v7mqyKqXqPbMkGul47nO0WfEnrWu/K2E bPUgzemzp+z9MIWhE0MddErCEYnnJ+quS33JtUzOaIefeKrlRs08tv0Qtg/n+I+ltk6N h9yeQJvUk8tj7pCLwMG1X9DV87iynDNn+M4HIGFL1rXsl3M22COP2no1K7mtsi7LxPkB WeYRBwSInGY+tVFPuk1VXbvSGJ1wpPNNGVsj7NbHxnB/ekcHWhQU4x9QnPeJJh/U3tR9 SjuD66puWykMPBdtVR+KJ3QMZzApo3/JG246K4J5dr436jrznCTf/7OjKemgf937B0Of X9HQ== X-Gm-Message-State: AOAM531CUO0qFk4gFGXRECHCthECDoPkoY/7hVuew2QrHOSAMmHExivu B6ZOq/sDYDBwDGEMjKpWCWtLDg== X-Google-Smtp-Source: ABdhPJx8zg+xIvj46lxu/GJT4AYzlWPR60Z7uZsdJhkbuo/CnbxPcZ5jQ2EYnkLbM/zey8iEvSiLIg== X-Received: by 2002:a92:9954:: with SMTP id p81mr6550098ili.25.1599189845273; Thu, 03 Sep 2020 20:24:05 -0700 (PDT) Received: from google.com ([2620:15c:183:200:7220:84ff:fe09:2d90]) by smtp.gmail.com with ESMTPSA id i85sm2593944ile.27.2020.09.03.20.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 20:24:04 -0700 (PDT) Date: Thu, 3 Sep 2020 21:24:00 -0600 From: Yu Zhao To: Michal Hocko Cc: Andrew Morton , Alex Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] mm: use add_page_to_lru_list()/page_lru()/page_off_lru() Message-ID: <20200904032400.GA4102421@google.com> References: <20200831175042.3527153-1-yuzhao@google.com> <20200903082832.GR4617@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200903082832.GR4617@dhcp22.suse.cz> X-Rspamd-Queue-Id: 792D71814B0C1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 Thu, Sep 03, 2020 at 10:28:32AM +0200, Michal Hocko wrote: > On Mon 31-08-20 11:50:41, Yu Zhao wrote: > [...] > > @@ -1860,16 +1859,11 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, > > lruvec = mem_cgroup_page_lruvec(page, pgdat); > > > > SetPageLRU(page); > > - lru = page_lru(page); > > - > > - nr_pages = thp_nr_pages(page); > > - update_lru_size(lruvec, lru, page_zonenum(page), nr_pages); > > - list_move(&page->lru, &lruvec->lists[lru]); > > + add_page_to_lru_list(page, lruvec, page_lru(page)); > > > > if (put_page_testzero(page)) { > > __ClearPageLRU(page); > > - __ClearPageActive(page); > > This should go into its own patch. The rest is a mechanical and clear. Thanks for reviewing. I assume you are worrying about PG_unevictable being set on the page because page_off_lru() checks it first. Well, if this can happen, wouldn't it have been triggering bad_page()? PG_unevictable is in PAGE_FLAGS_CHECK_AT_FREE. > This one needs some head scratching. E.g. Is it correct for all compound > pages. I believe it should be but few words on why would be better. It seems nothing special here when compared with other places that follow the same pattern. So I'm not sure what the concern is. > > - del_page_from_lru_list(page, lruvec, lru); > > + del_page_from_lru_list(page, lruvec, page_off_lru(page)); > > > > if (unlikely(PageCompound(page))) { > > spin_unlock_irq(&pgdat->lru_lock); > > @@ -1878,6 +1872,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, > > } else > > list_add(&page->lru, &pages_to_free); > > } else { > > + nr_pages = thp_nr_pages(page); > > nr_moved += nr_pages; > > if (PageActive(page)) > > workingset_age_nonresident(lruvec, nr_pages); > > -- > > 2.28.0.402.g5ffc5be6b7-goog > > > > -- > Michal Hocko > SUSE Labs