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=-13.6 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_AGENT_SANE_1, 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 4CFBCC433E6 for ; Tue, 1 Sep 2020 03:59:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D7D302078B for ; Tue, 1 Sep 2020 03:59:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="aE0f2vH2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7D302078B 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 469066B0003; Mon, 31 Aug 2020 23:59:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F37F6B0037; Mon, 31 Aug 2020 23:59:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BA6E6B0055; Mon, 31 Aug 2020 23:59:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 0F4426B0003 for ; Mon, 31 Aug 2020 23:59:40 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BFB60181AEF10 for ; Tue, 1 Sep 2020 03:59:39 +0000 (UTC) X-FDA: 77213138478.01.ear47_1e0a7d327095 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 7C47A10047828 for ; Tue, 1 Sep 2020 03:59:39 +0000 (UTC) X-HE-Tag: ear47_1e0a7d327095 X-Filterd-Recvd-Size: 5767 Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Sep 2020 03:59:38 +0000 (UTC) Received: by mail-ot1-f68.google.com with SMTP id a65so7311890otc.8 for ; Mon, 31 Aug 2020 20:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=el8iJcmxOaxJOWS4sBxpKnjD++a2+5Ro/otj+ZBjluA=; b=aE0f2vH2fWKwM5rp5aSui+5ZTSy2ZWY+LaNJKpegOkwFNDRcOa0Gz219cZHHw3/aJk HL7NPqz3LzVs76fcYikrbSSKovBLDWSIL7l+N96GhaggLNGsZ+iOFgNJDXXh7mWsm9Zi Wl0jVE9bAdfjlwhBitSpSG9up0K9u4ELiQegaI6e0UkHsTLMwvbHg1tVVmZeqRO1xzLu 1E/4RyB2Ggv8sPdYtMDchlOJ8IsIoir+Z/7GMKVNGwC4PGwts3M1niHO4+tu2wGwNrt5 wHLOp85kqLNb3p4IDT0w4ox4Px0opavig4UhBQ7krNMxFDxh6bP+h5BEW8oKhzwR7tjZ FYDQ== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=el8iJcmxOaxJOWS4sBxpKnjD++a2+5Ro/otj+ZBjluA=; b=BsejNuNE7V8Yrj/JfmCu7vH0D7WHe8HFnQaiLwHJkwVevlaMvJerquYvLzplUR4Ph/ dG3QJwxzHpQ3HsemDv4YVfsXfk4F0rR/VECc0OYqA8PhyurtNbvxf37K4mR0WalpnotP eZiobso8H9nobvDcrjraHSLQNkzVPA2YOnqNt0ScAhT6DmJamqw/Fu9gIhRZGK5CreuR M4J5//XWOycZTYvILHtNtEAWUoUdZqvBzT+5PD1Y62Doox6hlaTZ4jx/U2SYngO9Rt25 Ro8LGs2lV2KPLlz9t2nLw6EVwq/dBuFkqfRWPvYjMvGWP/XWVTvNrgQqz8NIuJJuch1h smug== X-Gm-Message-State: AOAM531IA/tUNN5yPHF20/PJutXyzjYXRRfT42+a2UF9nvcqn3s0DTrE L6pkkgOlmNVeOHDElScK5Fcl4Q== X-Google-Smtp-Source: ABdhPJz9PjlDrpfqy0fPfryU+nJtNXlq34EoIGFmVU9GzUCWSI54417v6I4cCggHlKPdb4Offb9fvg== X-Received: by 2002:a9d:48:: with SMTP id 66mr22439ota.83.1598932777791; Mon, 31 Aug 2020 20:59:37 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 10sm2217395otv.48.2020.08.31.20.59.35 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Mon, 31 Aug 2020 20:59:36 -0700 (PDT) Date: Mon, 31 Aug 2020 20:59:24 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Alex Shi cc: Hugh Dickins , Andrew Morton , Johannes Weiner , Michal Hocko , Mike Kravetz , Shakeel Butt , Matthew Wilcox , Qian Cai , Chris Wilson , Kuo-Hsin Yang , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 4/5] mm: fix check_move_unevictable_pages() on THP In-Reply-To: <5875bdbe-c1af-737b-9ec2-4b48b3c2465f@linux.alibaba.com> Message-ID: References: <5875bdbe-c1af-737b-9ec2-4b48b3c2465f@linux.alibaba.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1560420255-1598932776=:1019" X-Rspamd-Queue-Id: 7C47A10047828 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: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1560420255-1598932776=:1019 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 1 Sep 2020, Alex Shi wrote: > =E5=9C=A8 2020/8/31 =E4=B8=8A=E5=8D=885:08, Hugh Dickins =E5=86=99=E9=81= =93: > > --- 5.9-rc2/mm/vmscan.c=092020-08-16 17:32:50.721507348 -0700 > > +++ linux/mm/vmscan.c=092020-08-28 17:47:10.595580876 -0700 > > @@ -4260,8 +4260,14 @@ void check_move_unevictable_pages(struct > > =09for (i =3D 0; i < pvec->nr; i++) { > > =09=09struct page *page =3D pvec->pages[i]; > > =09=09struct pglist_data *pagepgdat =3D page_pgdat(page); > > +=09=09int nr_pages; > > + > > +=09=09if (PageTransTail(page)) > > +=09=09=09continue; > > + > > +=09=09nr_pages =3D thp_nr_pages(page); > > +=09=09pgscanned +=3D nr_pages; > > =20 > > -=09=09pgscanned++; > > =09=09if (pagepgdat !=3D pgdat) { > > =09=09=09if (pgdat) > > =09=09=09=09spin_unlock_irq(&pgdat->lru_lock); > > @@ -4280,7 +4286,7 @@ void check_move_unevictable_pages(struct > > =09=09=09ClearPageUnevictable(page); > > =09=09=09del_page_from_lru_list(page, lruvec, LRU_UNEVICTABLE); > > =09=09=09add_page_to_lru_list(page, lruvec, lru); >=20 > So, we might randomly del or add a thp tail page into lru? > It's interesting to know here. :) No, it wasn't that interesting, I'd have been more concerned if it was like that. Amusing idea though: because the act of adding a thp tail to lru would clear the very bit that says it's a tail. =09=09if (!PageLRU(page) || !PageUnevictable(page)) =09=09=09continue; Let's see: PageLRU and PageUnevictable are both of the PF_HEAD type, so permitted on tails, but always redirecting to head: so typically PageLRU(page) would be true, because head on lru; but PageUnevictable(page) would be false on tail, because head has already been moved to an evictable lru by this same function. So it safely went the "continue" way, but without incrementing pgrescued. Hugh >=20 > Thanks > Alex >=20 > > -=09=09=09pgrescued++; > > +=09=09=09pgrescued +=3D nr_pages; > > =09=09} > > =09} > > =20 --0-1560420255-1598932776=:1019--