From patchwork Thu Aug 18 13:00:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12947973 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 EFD70C00140 for ; Thu, 18 Aug 2022 21:15:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F9708E0001; Thu, 18 Aug 2022 17:15:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 681368D0002; Thu, 18 Aug 2022 17:15:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5227D8E0001; Thu, 18 Aug 2022 17:15:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 42DBB8D0002 for ; Thu, 18 Aug 2022 17:15:18 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 00BD91A1A7C for ; Thu, 18 Aug 2022 21:15:17 +0000 (UTC) X-FDA: 79813969116.30.077F675 Received: by imf21.hostedemail.com (Postfix, from userid 200) id 015941C00A1; Thu, 18 Aug 2022 15:59:11 +0000 (UTC) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf21.hostedemail.com (Postfix) with ESMTP id E3ACB1C388C for ; Thu, 18 Aug 2022 15:59:06 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4M7lMJ62f5zGpcF; Thu, 18 Aug 2022 20:59:08 +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.2375.24; Thu, 18 Aug 2022 21:00:42 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH 3/6] mm, hwpoison: fix extra put_page() in soft_offline_page() Date: Thu, 18 Aug 2022 21:00:13 +0800 Message-ID: <20220818130016.45313-4-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220818130016.45313-1-linmiaohe@huawei.com> References: <20220818130016.45313-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660838348; a=rsa-sha256; cv=none; b=UFUYRNuopdM74qFNskclOFKWNqwqfK4/W7rElREsTGG+0gyWbvX5OukIEy6qprFR8g0irG qb34ssU6o4XhaX7xXh7yPDATEHflnQXfHuFclthN2c/F+JDH43Q9oBzM2uF724c0fd5nBt jeRbT9QxbtTP/fUFvdINg/7sNySs5qo= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660838348; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z09LKwtbrH3Ub57kEyVhiVMCUeFKH6QYfIUUHEYEVuY=; b=HOAkvhruynuFzfHsexCk5xXYxB0dOARzhP+EjcMrbHBEToLM/pz9I3EgQdK2JZSwRqIojf iXmPS9g8NUFmdv41+gmAZA0RmrU8qwZcRmUdIls4AZeOYXVsfzSGVPWaK8D0aTQ1aTTHad FklzHVH7G6RHqomi2LZ4zSgkJoGusmI= Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: wzwiuqkdt1u1xz56towc5i1zncwksqsn X-Rspamd-Queue-Id: E3ACB1C388C X-HE-Tag: 1660838346-554721 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: When hwpoison_filter() refuses to soft offline a page, the page refcnt incremented previously by MF_COUNT_INCREASED would have been consumed via get_hwpoison_page() if ret <= 0. So the put_ref_page() here will put the extra one. Remove it to fix the issue. Fixes: 9113eaf331bf ("mm/memory-failure.c: add hwpoison_filter for soft offline") Signed-off-by: Miaohe Lin Acked-by: Naoya Horiguchi --- mm/memory-failure.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 0c5ad7505b99..7023c3d81273 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2591,8 +2591,6 @@ int soft_offline_page(unsigned long pfn, int flags) if (hwpoison_filter(page)) { if (ret > 0) put_page(page); - else - put_ref_page(ref_page); mutex_unlock(&mf_mutex); return -EOPNOTSUPP;