Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1442514pxk; Mon, 31 Aug 2020 21:04:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIUmJmk9vjYsdwhRADPtueGUYoUIf5/alV3xA8YFsc/+0FJFfUF1UTDegeB1GMZ39uvUPw X-Received: by 2002:a05:6402:1d93:: with SMTP id dk19mr97711edb.198.1598933085841; Mon, 31 Aug 2020 21:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598933085; cv=none; d=google.com; s=arc-20160816; b=zjbGiab36dPdyBvFIEBJPXt+aj8ZtvJwMGwTT6LiO+eRi6kvQP0vonzdafJct9bVTb wcfr2okHXPtS3qhuKGJIiDymO6iEizH/puw7CTGPJ+bQTkUHbL7M4boTkLXP8AEJBJxN H9Nn0YMcuQblqVvjYZpqpsF8TtHZndngGJoQkIH4aSlVmOQHpmLCiHieP2NADLemPO6J 9BbFBW15dGvmlV4ClKf4EgAHzSVj8f1/b2tFERRd1Nnxn04sa5fPNXRM4LwclHAu7ygO ZEW2+/iCs3lJUB4vLFETImnonCGtTw8Kzr2N+Inf2yiKQlycjEJUY9X4HY+1Ku8Si9oI 1dHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=el8iJcmxOaxJOWS4sBxpKnjD++a2+5Ro/otj+ZBjluA=; b=XqG6hr9SwhjBLnP1zHmiDQ1Sw87vtbvQNvoy4RPkI2aCHsVwdWgmFEzwRv+k8V5WMf OM80Cn8C3Z8gQWXnmSuga1ukHNv4X8GRjEMZHR4aeeUmjTwHoD4jEL99ykcEyfP7+H2s 8cA1QrWsTx75U5c6tKyB1rpdUVspMQr3+eXxSOB6u57mMB/JWjcrgoieroEsz6q/BC+a w+yuXVl7urwQycQEJRwfMVPk7/7kJUIJ/vDvPv9UlQmOFYjBu1jhh4ucjfz3E2zNCs4w J6424BYeKTb46TG/XzlmXbWkacKJfS+X/Vhcn72bfJRKp80jMMAZttvd0Cha/KQGDtGz lFFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aE0f2vH2; 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 k8si18723ejc.211.2020.08.31.21.04.21; Mon, 31 Aug 2020 21:04:45 -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=aE0f2vH2; 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 S1726490AbgIAD7j (ORCPT + 99 others); Mon, 31 Aug 2020 23:59:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbgIAD7j (ORCPT ); Mon, 31 Aug 2020 23:59:39 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF3D5C0612FE for ; Mon, 31 Aug 2020 20:59:38 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id 37so7525oto.4 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=ZgcPOHPwwjoLfn27cSUbq9LsrVH5VgGTFQnmFTCaERkz1JFGJanoYrFor0kqXd9n86 USNMDvBD8yFDeaId8uew9cBxg6/ji3VSteS1XrvwDDB6CFPgOZFqWQZ1003iDn6tDAhf WnAGl++RN9j5sy5LvJqke3EE/9JP/RnXzdtfSt7ph0PRYQNXLdL8qtSrMvdhWdIeRzpC RuciRgHr0oefiloQahmBR4MJ+nXsiWKduCxHIseNIiXOz3Jx5JEu3sIzzW9jhy0hH25x MGWF54luezHxTHBB8afwzfdcKGlgzx0DJ8fnIB1W1JZaHG2Q7LidKjH8fzPp+iYcjEgK QLlA== X-Gm-Message-State: AOAM531uOuHCop8TfqaXjOHh0AzLJsALoGDKSQdBfjkVMQARegFlLGv3 pVbrZYh6jRaY9Y5rwWAyzHkX8w== 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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--