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 D4347C433EF for ; Fri, 18 Mar 2022 06:29:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38FFB8D0003; Fri, 18 Mar 2022 02:29:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 33FB68D0001; Fri, 18 Mar 2022 02:29:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 208698D0003; Fri, 18 Mar 2022 02:29:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 114EC8D0001 for ; Fri, 18 Mar 2022 02:29:21 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id E9385121BBD for ; Fri, 18 Mar 2022 06:29:20 +0000 (UTC) X-FDA: 79256530080.04.F2B94C6 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf17.hostedemail.com (Postfix) with ESMTP id 0D27640017 for ; Fri, 18 Mar 2022 06:29:19 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4KKYsd3mG4z9sfW; Fri, 18 Mar 2022 14:25:25 +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.2308.21; Fri, 18 Mar 2022 14:29:15 +0800 Subject: Re: [PATCH v3 1/2] mm/memory-failure.c: avoid calling invalidate_inode_page() with unexpected pages To: David Hildenbrand CC: , , , , , References: <20220318073945.62164-1-linmiaohe@huawei.com> <20220318073945.62164-2-linmiaohe@huawei.com> <79e0be67-341d-34cb-bb48-30f122d9e239@redhat.com> From: Miaohe Lin Message-ID: <9bd4f53c-fba4-f0f5-68d1-4b2acaab4213@huawei.com> Date: Fri, 18 Mar 2022 14:29:15 +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: <79e0be67-341d-34cb-bb48-30f122d9e239@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0D27640017 X-Stat-Signature: 44s3cprf4bmzi55zjosgd1jor3puoc68 Authentication-Results: imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-HE-Tag: 1647584959-102279 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/3/17 20:29, David Hildenbrand wrote: > On 18.03.22 08:39, Miaohe Lin wrote: >> invalidate_inode_page() can invalidate the pages in the swap cache because >> the check of page->mapping != mapping is removed via Matthew's patch titled >> "mm/truncate: Inline invalidate_complete_page() into its one caller". But >> invalidate_inode_page() is not expected to deal with the pages in the swap >> cache. Also non-lru movable page can reach here too. They're not page cache >> pages. Skip these pages by checking PageSwapCache and PageLRU to fix this >> unexpected issue. >> >> 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 5444a8ef4867..ecf45961f3b6 100644 >> --- a/mm/memory-failure.c >> +++ b/mm/memory-failure.c >> @@ -2178,7 +2178,7 @@ static int __soft_offline_page(struct page *page) >> return 0; >> } >> >> - if (!PageHuge(page)) >> + if (!PageHuge(page) && PageLRU(page) && !PageSwapCache(page)) >> /* >> * Try to invalidate first. This should work for >> * non dirty unmapped page cache pages. > > I'm not familiar with this code to ack this, but it looks sane to me. > Thanks David.