From patchwork Fri Nov 25 06:54:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mawupeng X-Patchwork-Id: 13055568 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 BB4AAC433FE for ; Fri, 25 Nov 2022 06:54:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4CFB6B0071; Fri, 25 Nov 2022 01:54:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CFD7F6B0072; Fri, 25 Nov 2022 01:54:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC4826B0073; Fri, 25 Nov 2022 01:54:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A96F16B0071 for ; Fri, 25 Nov 2022 01:54:58 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 76429C0D07 for ; Fri, 25 Nov 2022 06:54:58 +0000 (UTC) X-FDA: 80171052276.25.65E8193 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id DF82E1C000D for ; Fri, 25 Nov 2022 06:54:56 +0000 (UTC) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NJQZd1Nw0zRnvL; Fri, 25 Nov 2022 14:54:17 +0800 (CST) Received: from dggpemm500014.china.huawei.com (7.185.36.153) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 25 Nov 2022 14:54:49 +0800 Received: from localhost.localdomain (10.175.112.125) by dggpemm500014.china.huawei.com (7.185.36.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 25 Nov 2022 14:54:49 +0800 From: Wupeng Ma To: CC: , , , , , Subject: [PATCH -next 1/1] mm/memory-failure.c: Cleanup in unpoison_memory Date: Fri, 25 Nov 2022 14:54:44 +0800 Message-ID: <20221125065444.3462681-1-mawupeng1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500014.china.huawei.com (7.185.36.153) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669359298; a=rsa-sha256; cv=none; b=6wSzfClyTJxrNibiE4jWDwKzNr4o78qwZZivikA4KJcHWtbLT9o5aQV4hey0FjLAgdk4PJ 81c3NqFh/EaJ+K4wVzl0f+hWGAYJ3y0b/IpV1BLUjEIoFMbpoUlY79THGiSjP0jmjIeXRU vbrbcFtznXQsNKdyAXGBR7HGVICHjcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669359298; 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: references; bh=ae4wxTG1QesfVYKAK9kgEaz+2sTnRMSKuQcSGkywipg=; b=sgHqVkd7QPx6LSGPZMmSPTXgAbQmWEP2hpPSxUKoOlxABCM6n7BY2aZZPc0EuMN7hSOlwO C37Lr8iMy8VnhLEsJZ1KfMPY9oUKrasmZOk9wkfHds3MRraMsOI2vQcwOaFCXjPVbVN6/Q dP1Oa4LSt7UxmWZp7ZdvB1MZ9W4kw8w= Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Queue-Id: DF82E1C000D X-Rspamd-Server: rspam01 X-Stat-Signature: cg4foqcqkrg8u75biy1p9848h39woka9 X-HE-Tag: 1669359296-498252 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: From: Ma Wupeng If freeit it true, the value of ret must be zero, there is no need to check the value of freeit after label unlock_mutex. We can drop variable freeit to do this cleanup. Signed-off-by: Ma Wupeng Acked-by: Naoya Horiguchi Reviewed-by: Miaohe Lin --- mm/memory-failure.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 2e62940c7bae..c77a9e37e27e 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2338,7 +2338,6 @@ int unpoison_memory(unsigned long pfn) struct page *page; struct page *p; int ret = -EBUSY; - int freeit = 0; unsigned long count = 1; bool huge = false; static DEFINE_RATELIMIT_STATE(unpoison_rs, DEFAULT_RATELIMIT_INTERVAL, @@ -2413,10 +2412,9 @@ int unpoison_memory(unsigned long pfn) goto unlock_mutex; } } - freeit = !!TestClearPageHWPoison(p); put_page(page); - if (freeit) { + if (TestClearPageHWPoison(p)) { put_page(page); ret = 0; } @@ -2424,7 +2422,7 @@ int unpoison_memory(unsigned long pfn) unlock_mutex: mutex_unlock(&mf_mutex); - if (!ret || freeit) { + if (!ret) { if (!huge) num_poisoned_pages_sub(pfn, 1); unpoison_pr_info("Unpoison: Software-unpoisoned page %#lx\n",