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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 57387C2BA19 for ; Tue, 21 Apr 2020 08:32:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2546D2084D for ; Tue, 21 Apr 2020 08:32:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2546D2084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CBD678E0006; Tue, 21 Apr 2020 04:32:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C6E798E0003; Tue, 21 Apr 2020 04:32:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA8828E0006; Tue, 21 Apr 2020 04:32:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id A04618E0003 for ; Tue, 21 Apr 2020 04:32:13 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 70C6A4DA8 for ; Tue, 21 Apr 2020 08:32:13 +0000 (UTC) X-FDA: 76731194946.18.elbow77_87b9cbd94ea16 X-HE-Tag: elbow77_87b9cbd94ea16 X-Filterd-Recvd-Size: 2926 Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com [47.88.44.36]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Tue, 21 Apr 2020 08:32:12 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R681e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0TwDHj5a_1587457757; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TwDHj5a_1587457757) by smtp.aliyun-inc.com(127.0.0.1); Tue, 21 Apr 2020 16:29:17 +0800 Subject: Re: [PATCH 01/18] mm: fix NUMA node file count error in replace_page_cache() To: Johannes Weiner , Joonsoo Kim Cc: Shakeel Butt , Hugh Dickins , Michal Hocko , "Kirill A. Shutemov" , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com References: <20200420221126.341272-1-hannes@cmpxchg.org> <20200420221126.341272-2-hannes@cmpxchg.org> From: Alex Shi Message-ID: Date: Tue, 21 Apr 2020 16:28:10 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200420221126.341272-2-hannes@cmpxchg.org> Content-Type: text/plain; charset=gbk 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: =D4=DA 2020/4/21 =C9=CF=CE=E76:11, Johannes Weiner =D0=B4=B5=C0: > When replacing one page with another one in the cache, we have to > decrease the file count of the old page's NUMA node and increase the > one of the new NUMA node, otherwise the old node leaks the count and > the new node eventually underflows its counter. >=20 > Fixes: 74d609585d8b ("page cache: Add and replace pages using the XArra= y") > Signed-off-by: Johannes Weiner Reviewed-by: Alex Shi > --- > mm/filemap.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/mm/filemap.c b/mm/filemap.c > index 23a051a7ef0f..49e3b5da0216 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -808,11 +808,11 @@ int replace_page_cache_page(struct page *old, str= uct page *new, gfp_t gfp_mask) > old->mapping =3D NULL; > /* hugetlb pages do not participate in page cache accounting. */ > if (!PageHuge(old)) > - __dec_node_page_state(new, NR_FILE_PAGES); > + __dec_node_page_state(old, NR_FILE_PAGES); > if (!PageHuge(new)) > __inc_node_page_state(new, NR_FILE_PAGES); > if (PageSwapBacked(old)) > - __dec_node_page_state(new, NR_SHMEM); > + __dec_node_page_state(old, NR_SHMEM); > if (PageSwapBacked(new)) > __inc_node_page_state(new, NR_SHMEM); > xas_unlock_irqrestore(&xas, flags); >=20