Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1135987pxk; Mon, 31 Aug 2020 10:44:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3B+sHYhoXjmatjKoWzyVQmu4lEMRyTc0ddhHVNC7R9GNj95ogN1qvwmHvT0X3jNtQD6hB X-Received: by 2002:a17:907:205c:: with SMTP id pg28mr1945711ejb.22.1598895850053; Mon, 31 Aug 2020 10:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598895850; cv=none; d=google.com; s=arc-20160816; b=rAh6/cemEEaHlweEpF8g8+W05ei/6zC0v1ulJ72Ww8+Q0Z/wUinB6XH0RMOAu4Wep9 vOiBpA3K40acYJtVCFN1LS9qEKfF7iQ4/5IithGaIsTNkZau9O7PlJMVZsE+Ec95585i 5FWggtzZffMYd6+s5s6if7q05TYPf1L0ia1YEuMt14BstiEYXfYG64UfIOmo1PbqKfi2 9TWpWm+ZQRX5r/Q0BsPIkDzmD4ZJMU4c2Eu1HFxXOUBBwl1efeCtvSljGmBcTVALSVkI zBQ0JWrdShqbveLpjD+HqkEof0AHHRDGGId6aEyKlelBoVFYh2Ay3ArKoLwlzU4Dj8bk pDIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ewFGJB7Yo/8GFDwyV3N5XMzE2CDy3u6mUf+bWLFImZM=; b=wBYqXqhbNlv7buNvZjkB92emefsYv9Di23zD37Bf2WoNanvpqwRCv2bTAe4I64JTwm grGYNo/+NKoIAMl5BxEOfsN5ZySuzM0imYHn6y+IA56sPsNw5WttYKGiGLJz8iG2/pzB E0CruI21I6Qc7lqfMcc9NX6r7WH/sl8ykjKz0gA66d51CAdwC9ncW/TbjRNpbrKNgyBE KcFVzMxPBX60Fp1XxXVdCeo+GTpmNUCs7vNk8NM22iD5TNBWg8u7OkxAx8cO0Jyb/nxl BZP1iG9cNsuuheQqiKc6PU2vCpW/yKrDj4UYqnnI0SMQRVj92lJJbAXuWD/YmDHpLmI8 HurA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pjPv+EQf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb22si5949631ejb.152.2020.08.31.10.43.47; Mon, 31 Aug 2020 10:44:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pjPv+EQf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbgHaRmE (ORCPT + 99 others); Mon, 31 Aug 2020 13:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726204AbgHaRmA (ORCPT ); Mon, 31 Aug 2020 13:42:00 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3FBFC061573 for ; Mon, 31 Aug 2020 10:41:59 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id h4so6899738ioe.5 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=G91SbAXMmFM5fWEzYbyh6f6c+D+v4VW4OjcjWqwMJwIb+9HbWdQQ0HGju3jds5Q3kT 2hhL9f26EqgC9iYDQ2r1URFO3k0TT3Xu6FPWlNhr6KrgZQ2Hl7HhMUknEJ+G4d43SO9G xLYBnsGXWTeC0LGpmveVZqau0MRfr0XppTvpXElJqPGosNgJGevJgd5h4QrjRuti6dR5 P7CTpWGLIcbdVaIn0GID0YW0uCNgAeCOPvW9dNwbfOUNwWmwuulrRzz21MQmcdeYe2XK p445oTegQz8zU4Kf1DeCXMWU125RcSv1xlnwP8QAqmQlhWvUKE6BLqyw6GG3Fev47m0H vnOQ== X-Gm-Message-State: AOAM53206GQkADQkW5EP97in/3YcWmYLR8+2Vw37mbdB5NgeH3uqrCW2 rXixrOhzpDBlNcKeluYA3kiA79wmZvcFkA== 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 Content-Transfer-Encoding: 8bit In-Reply-To: <20200830234404.GA3192017@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: > > > > > > 在 2020/8/30 上午2:12, Yu Zhao 写道: > > > 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 > > > > > > 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). > > > > > > So would you mind taking of the clean-up too in your series? I'll > > > drop this one then. Thanks. > > Ok, maybe I wasn't clear before. Please see what exactly I'm asking > you to consider below. > > > >> 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 = PageActive(page); > > >> int nr_pages = thp_nr_pages(page); > > >> > > >> - 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); > > >> /* > > 1) The above has no conflict with your series and therefore can go > separately. Feel free to include it. > > > >> 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_pages_to_lru(struct lruvec *lruvec, > > >> int nr_pages, nr_moved = 0; > > >> LIST_HEAD(pages_to_free); > > >> struct page *page; > > >> - enum lru_list lru; > > >> > > >> while (!list_empty(list)) { > > >> page = 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); > > 2) The above is the same change you've made. > > > >> @@ -1860,16 +1859,10 @@ 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); > > > > it's interesting to know the PageLRU left has no bad impact in real life. > > it justs seems a path confliction with my that patch. > > (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.