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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB499C433F5 for ; Mon, 28 Feb 2022 14:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236897AbiB1OEV (ORCPT ); Mon, 28 Feb 2022 09:04:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233491AbiB1OEO (ORCPT ); Mon, 28 Feb 2022 09:04:14 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC8BB4968D for ; Mon, 28 Feb 2022 06:03:34 -0800 (PST) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4K6hnB6ZcNz1GBw2; Mon, 28 Feb 2022 21:58:54 +0800 (CST) Received: from huawei.com (10.175.124.27) 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; Mon, 28 Feb 2022 22:03:31 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH 2/4] mm/memory-failure.c: fix wrong user reference report Date: Mon, 28 Feb 2022 22:02:43 +0800 Message-ID: <20220228140245.24552-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220228140245.24552-1-linmiaohe@huawei.com> References: <20220228140245.24552-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The dirty swapcache page is still residing in the swap cache after it's hwpoisoned. So there is always one extra refcount for swap cache. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 0d7c58340a98..5f9503573263 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -984,7 +984,6 @@ static int me_pagecache_dirty(struct page_state *ps, struct page *p) static int me_swapcache_dirty(struct page_state *ps, struct page *p) { int ret; - bool extra_pins = false; ClearPageDirty(p); /* Trigger EIO in shmem: */ @@ -993,10 +992,7 @@ static int me_swapcache_dirty(struct page_state *ps, struct page *p) ret = delete_from_lru_cache(p) ? MF_FAILED : MF_DELAYED; unlock_page(p); - if (ret == MF_DELAYED) - extra_pins = true; - - if (has_extra_refcount(ps, p, extra_pins)) + if (has_extra_refcount(ps, p, true)) ret = MF_FAILED; return ret; -- 2.23.0