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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40AE6C433F5 for ; Sat, 9 Apr 2022 02:36:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B18766B0071; Fri, 8 Apr 2022 22:36:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC7AD6B0073; Fri, 8 Apr 2022 22:36:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B5936B0074; Fri, 8 Apr 2022 22:36:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 8DDDC6B0071 for ; Fri, 8 Apr 2022 22:36:23 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 609A924CA0 for ; Sat, 9 Apr 2022 02:36:23 +0000 (UTC) X-FDA: 79335776646.20.2B461EB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf21.hostedemail.com (Postfix) with ESMTP id 9E9DB1C0003 for ; Sat, 9 Apr 2022 02:36:22 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KZzkZ00S8zdZnT; Sat, 9 Apr 2022 10:35:49 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 9 Apr 2022 10:36:20 +0800 Subject: Re: [PATCH 1/3] mm/memory-failure.c: avoid false-postive PageSwapCache test To: Yang Shi , David Hildenbrand CC: Andrew Morton , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Mike Kravetz , Linux MM , Linux Kernel Mailing List References: <20220407130352.15618-1-linmiaohe@huawei.com> <20220407130352.15618-2-linmiaohe@huawei.com> <09d363ba-5bd0-75ae-8ece-cd91997f1b46@redhat.com> From: Miaohe Lin Message-ID: <80b5b191-222b-493c-0192-80ceb5afafa8@huawei.com> Date: Sat, 9 Apr 2022 10:36:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Stat-Signature: s6trc91yqqwwb87otifpeah49js9uzj3 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9E9DB1C0003 Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-HE-Tag: 1649471782-532262 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 2022/4/9 1:32, Yang Shi wrote: > On Fri, Apr 8, 2022 at 1:52 AM David Hildenbrand wrote: >> >> On 07.04.22 15:03, Miaohe Lin wrote: >>> PageSwapCache is only reliable when PageAnon is true because PG_swapcache >>> serves as PG_owner_priv_1 which can be used by fs if it's pagecache page. >>> So we should test PageAnon to distinguish pagecache page from swapcache >>> page to avoid false-postive PageSwapCache test. >> >> Well, that's not quite correct. Just because a page is PageAnon() >> doesn't mean that it's in the swapache. It means that it might be in the >> swapcache but cannot be in the pagecache. >> >> Maybe you wanted to say >> >> "So we should test PageAnon() to distinguish pagecache pages from >> anonymous pages." That's indeed what I want to say. > > Yeah, I agree. The patch looks fine to me with David's comment addressed. Many thanks for both of you! Will do it in v3. > >> >>> >>> Signed-off-by: Miaohe Lin >>> --- >>> mm/memory-failure.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c >>> index ef402b490663..2e97302d62e4 100644 >>> --- a/mm/memory-failure.c >>> +++ b/mm/memory-failure.c >>> @@ -2262,7 +2262,7 @@ static int __soft_offline_page(struct page *page) >>> return 0; >>> } >>> >>> - if (!PageHuge(page) && PageLRU(page) && !PageSwapCache(page)) >>> + if (!PageHuge(page) && PageLRU(page) && !PageAnon(page)) >>> /* >>> * Try to invalidate first. This should work for >>> * non dirty unmapped page cache pages. >> >> >> -- >> Thanks, >> >> David / dhildenb >> >> > . >