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=-7.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 F1184C433E6 for ; Mon, 31 Aug 2020 17:42:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B062820678 for ; Mon, 31 Aug 2020 17:42:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="pjPv+EQf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B062820678 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 2CDF66B0003; Mon, 31 Aug 2020 13:42:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 27E3E6B0037; Mon, 31 Aug 2020 13:42:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1951B6B0055; Mon, 31 Aug 2020 13:42:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id DF4856B0003 for ; Mon, 31 Aug 2020 13:42:00 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9603A1E12 for ; Mon, 31 Aug 2020 17:42:00 +0000 (UTC) X-FDA: 77211582000.28.spark48_230b6ef27091 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 6A4626C04 for ; Mon, 31 Aug 2020 17:42:00 +0000 (UTC) X-HE-Tag: spark48_230b6ef27091 X-Filterd-Recvd-Size: 6969 Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Mon, 31 Aug 2020 17:41:59 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id j2so6901325ioj.7 for ; Mon, 31 Aug 2020 10:41:59 -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:content-transfer-encoding:in-reply-to; bh=ewFGJB7Yo/8GFDwyV3N5XMzE2CDy3u6mUf+bWLFImZM=; b=pjPv+EQfSUL4TQJ85behcq0hYhbTAd2A7UCL4kMzn7UDMblEYODN0vboVBSIQGNZxj voNnsRL/xIvF+Mkor0PqmFzqKtSOVCJEo6K3tAdESXeZhyI2GNVY2NQXtU27P+IXKO3G 6LOnvkM+BzOU4HzKuKpA8SF9Z1gd9FyEmzufJWI6YWEZMN2fhSV6HoZq0USLidpwHIuo Ha53wSY3MzLYX3pyaXmbhjyTnJjKEy9i8+TI7NNO4AafTVc9kZ5aw8nV8JNTs3EFWVVF /PWksbyPSYED4Y/2a4rIE6YUGQbxNKl63CgRk38r+Zyj7qrClLim0VIm2bRJRkIlpCKc IHdg== 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:content-transfer-encoding :in-reply-to; bh=ewFGJB7Yo/8GFDwyV3N5XMzE2CDy3u6mUf+bWLFImZM=; b=IvExDeLyZJjV3gR4246KgEgC9K4UwRGI4H/vJHqeYxbw3F3QnDGlex16jktk/M05Ex 5/syburoJaDvyTy6/QKgPu1t/ErZZWn1oa09phsN2mleK9QNWKhcDwbWTP/6X6u2wKRe NTZBxKT8r3tdgCGDraMot/z2AMtt3r3QhcfPu90sO2QmNss65TW3rnzM/WkVtYQ6pzct jd/o8Bm2MO5R2I+NiwqgRByz9DGg0ZVmjNUXJEU4p8QhqEmKskOAxnH+VzxqX6tCFP60 JOtt/++XQ7qk4yRkW2BkquC7Vwt/VMvJUuMQU/XTbGNhSDGTAnheZkucU0ruJNoqGNZC Nfzg== X-Gm-Message-State: AOAM530XjQcvdxNXaOnnDjXKWshStNERn4h/7Czo9qkLQLRJa9co+yx6 SsyaqOMQNo+d/b8WQWPQh2axvA== X-Google-Smtp-Source: ABdhPJxhLWcWjK8Kv6fr+z1o4nPE9GMBHeliT4bo4kKEx6yjVgtbi+WL+P8R0c9ggr+eoXd/RUBa0g== X-Received: by 2002:a05:6638:1393:: with SMTP id w19mr2191811jad.113.1598895719012; Mon, 31 Aug 2020 10:41:59 -0700 (PDT) Received: from google.com ([2620:15c:183:200:7220:84ff:fe09:2d90]) by smtp.gmail.com with ESMTPSA id 2sm2157550ilj.24.2020.08.31.10.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 10:41:58 -0700 (PDT) Date: Mon, 31 Aug 2020 11:41:54 -0600 From: Yu Zhao To: Alex Shi Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Subject: Re: [PATCH 1/2] mm: use add_page_to_lru_list()/page_lru()/page_off_lru() Message-ID: <20200831174154.GA3428138@google.com> References: <20200827234202.4027996-1-yuzhao@google.com> <20200829181213.GA838419@google.com> <20200830234404.GA3192017@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200830234404.GA3192017@google.com> X-Rspamd-Queue-Id: 6A4626C04 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 Content-Transfer-Encoding: quoted-printable 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 Sun, Aug 30, 2020 at 05:44:04PM -0600, Yu Zhao wrote: > On Sun, Aug 30, 2020 at 04:31:38PM +0800, Alex Shi wrote: > >=20 > >=20 > > =E5=9C=A8 2020/8/30 =E4=B8=8A=E5=8D=882:12, Yu Zhao =E5=86=99=E9=81=93= : > > > On Thu, Aug 27, 2020 at 05:42:01PM -0600, Yu Zhao wrote: > > >> This is a trivial but worth having clean-up patch. There should be > > >> no side effects except page->lru is temporarily poisoned after it'= s > > >> deleted but before it's added to the new list in move_pages_to_lru= () > > >> (which is not a problem). > > >> > > >> Signed-off-by: Yu Zhao > > >=20 > > > Hi Alex, I just realized your > > > [v18,08/32] mm/vmscan: remove unnecessary lruvec adding > > > at > > > https://patchwork.kernel.org/patch/11733123/ > > > also touches move_pages_to_lru(). I agree it's better not to add > > > a page we are going to free to the list in the first place. The > > > rest in this patch would be too trivial to be a separate one (on > > > top of yours). > > >=20 > > > So would you mind taking of the clean-up too in your series? I'll > > > drop this one then. Thanks. >=20 > Ok, maybe I wasn't clear before. Please see what exactly I'm asking > you to consider below. >=20 > > >> diff --git a/mm/swap.c b/mm/swap.c > > >> index 40bf20a75278..2735ecf0f566 100644 > > >> --- a/mm/swap.c > > >> +++ b/mm/swap.c > > >> @@ -597,11 +597,9 @@ static void lru_lazyfree_fn(struct page *page= , struct lruvec *lruvec, > > >> { > > >> if (PageLRU(page) && PageAnon(page) && PageSwapBacked(page) && > > >> !PageSwapCache(page) && !PageUnevictable(page)) { > > >> - bool active =3D PageActive(page); > > >> int nr_pages =3D thp_nr_pages(page); > > >> =20 > > >> - del_page_from_lru_list(page, lruvec, > > >> - LRU_INACTIVE_ANON + active); > > >> + del_page_from_lru_list(page, lruvec, page_lru(page)); > > >> ClearPageActive(page); > > >> ClearPageReferenced(page); > > >> /* >=20 > 1) The above has no conflict with your series and therefore can go > separately. Feel free to include it. >=20 > > >> diff --git a/mm/vmscan.c b/mm/vmscan.c > > >> index 99e1796eb833..b479ced26cd3 100644 > > >> --- a/mm/vmscan.c > > >> +++ b/mm/vmscan.c > > >> @@ -1845,13 +1845,12 @@ static unsigned noinline_for_stack move_pa= ges_to_lru(struct lruvec *lruvec, > > >> int nr_pages, nr_moved =3D 0; > > >> LIST_HEAD(pages_to_free); > > >> struct page *page; > > >> - enum lru_list lru; > > >> =20 > > >> while (!list_empty(list)) { > > >> page =3D lru_to_page(list); > > >> VM_BUG_ON_PAGE(PageLRU(page), page); > > >> + list_del(&page->lru); > > >> if (unlikely(!page_evictable(page))) { > > >> - list_del(&page->lru); > > >> spin_unlock_irq(&pgdat->lru_lock); > > >> putback_lru_page(page); > > >> spin_lock_irq(&pgdat->lru_lock); >=20 > 2) The above is the same change you've made. >=20 > > >> @@ -1860,16 +1859,10 @@ static unsigned noinline_for_stack move_pa= ges_to_lru(struct lruvec *lruvec, > > >> lruvec =3D mem_cgroup_page_lruvec(page, pgdat); > > >> =20 > > >> SetPageLRU(page); > > >> - lru =3D page_lru(page); > > >> - > > >> - nr_pages =3D 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)); > > >> =20 > > >> if (put_page_testzero(page)) { > > >> - __ClearPageLRU(page); > >=20 > > it's interesting to know the PageLRU left has no bad impact in real l= ife.=20 > > it justs seems a path confliction with my that patch.=20 >=20 > (No, we can't leave PG_lru uncleared. It's done by the page_off_lru() > right below). Sorry about this false claim. You are right: we need to keep __ClearPageLRU() here. page_off_lru() doesn't do it for us. I'll fix this in v2. Thanks.