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 A2FC2C43461 for ; Fri, 4 Sep 2020 16:54:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 36052206B7 for ; Fri, 4 Sep 2020 16:54:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="o4rLgyn8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36052206B7 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 800E08E0003; Fri, 4 Sep 2020 12:54:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B1778E0001; Fri, 4 Sep 2020 12:54:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C89D8E0003; Fri, 4 Sep 2020 12:54:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id 568648E0001 for ; Fri, 4 Sep 2020 12:54:44 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 210AC1F06 for ; Fri, 4 Sep 2020 16:54:44 +0000 (UTC) X-FDA: 77225978088.02.sea47_5a11907270b3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id EF828100A2A4E for ; Fri, 4 Sep 2020 16:54:43 +0000 (UTC) X-HE-Tag: sea47_5a11907270b3 X-Filterd-Recvd-Size: 5284 Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Fri, 4 Sep 2020 16:54:43 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id r9so7845592ioa.2 for ; Fri, 04 Sep 2020 09:54:43 -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=yuyjbFHoO/MfKcJCdSK7UzvOyTNj/L7bhfgE/kRmYrI=; b=o4rLgyn8Ia62kQ510NnS41tFAUR14f/25JpG4QxR1t3v6u2Ph5mZ/wVWzd0IsvlCua HWUfuFohjJrLkPsaQdyzC4cTyv9vmVPi/CZVPoVdDSjREVUYStTlViWHn9jFYfsSEx77 7u5HMl5d7CmMv9w3mJjhKSKZfxykcrclOyXmqGWajNo1C3vTMT0J9gOqCVOEz9tFmIQU Xu0biTepgJ7S41//yt8ix++XO8tjr6+dnwuC+Wq79nivDIw7R6qx6VPiY8ydbHifMXGv 2E6AdHSBfK5t7Vv30RuDFC/pz2fHgi3USf+RAwht0XcOM16usa4G66B3FmzUTJq2ZQ6Z HWyw== 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=yuyjbFHoO/MfKcJCdSK7UzvOyTNj/L7bhfgE/kRmYrI=; b=DltlC+vVZE/buQCitB976TcCQZ319s4CQ6qzIo74wr4hycEDXpAEy8HVqwKrrW8xal u306i5o3rK45BttSCyEL3Ja+WL+X5BRAp5515WMKHNnoYZ8F2U9572PaiXoHDzQ+GHvD c+A29nOjaFjfKr0cnLF0wrbIP2zXOntK9HDppcaKcXM/MLKad6zNItEwzJWyvgIaiAXE w3Hed08hXJflXF9nAcFwDgigHVWiXf919Iuw3Z4ac6t45K8hsFORq8KNIG/0f3c38zsK jvGxZoTcXvvTgouEwcgS58bIQsK7NVek+t8mvT5ZGnWHAmN31aH85MSV5shfRkEOOr0L fLoQ== X-Gm-Message-State: AOAM530W5Oxp1WaO/EBOGel+8zj/ZXo8CtsXYA9Z7+WOITuK74Ty1Ka0 rPPAeh04OqbUHPa5hLszJvKS+A== X-Google-Smtp-Source: ABdhPJyvjCMO8yHsIwpQyd+tA1kiQKGBNHJ4w4x3gKmZwPYKev70Sc0PceLLJ2pEPctmG59ok2Cy+Q== X-Received: by 2002:a6b:2b45:: with SMTP id r66mr8318965ior.159.1599238482727; Fri, 04 Sep 2020 09:54:42 -0700 (PDT) Received: from google.com ([2620:15c:183:200:7220:84ff:fe09:2d90]) by smtp.gmail.com with ESMTPSA id w17sm348678ilo.36.2020.09.04.09.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 09:54:41 -0700 (PDT) Date: Fri, 4 Sep 2020 10:54:37 -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: <20200904165437.GA77761@google.com> References: <20200831175042.3527153-1-yuzhao@google.com> <20200903082832.GR4617@dhcp22.suse.cz> <20200904032400.GA4102421@google.com> <20200904105001.GH15277@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200904105001.GH15277@dhcp22.suse.cz> X-Rspamd-Queue-Id: EF828100A2A4E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 Fri, Sep 04, 2020 at 12:50:01PM +0200, Michal Hocko wrote: > On Thu 03-09-20 21:24:00, Yu Zhao wrote: > > 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. > > No, I was referring to __ClearPageActive. You are right that this is > cleared in page_off_lru but that is hidden in a release path and e.g. > compound pages are released via their destructor which for some might > not involve releasing the page - e.g. hugetlb pages. This should be fine > because hugetlb pages are not on LRU so as I've said this is fine but it > belongs to its own patch because it is not a pure mechanical change like > the rest of the patch. Please bear with me. This is the change in question: if (put_page_testzero(page)) { __ClearPageLRU(page); - __ClearPageActive(page); - del_page_from_lru_list(page, lruvec, lru); + del_page_from_lru_list(page, lruvec, page_off_lru(page)); if (unlikely(PageCompound(page))) { If the PageUnevictable() check in page_off_lru() is not a concern, I'm trying to understand what else is different between them: Before this path: After this patch: page_off_lru() __ClearPageActive() __ClearPageActive() add_page_to_lru_list() add_page_to_lru_list() And why is page_off_lru() hidden in a release path?