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: 25851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3816715wrr; Thu, 24 Nov 2022 23:04:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Uwi7Q8ieEc7+v/tgLq5c5gUUSskTEDPDKvFtaPRRcoe4mhsYiS43hx6nu2UjMHIJTbZu9 X-Received: by 2002:a17:902:f391:b0:177:ed70:70ff with SMTP id f17-20020a170902f39100b00177ed7070ffmr18393526ple.28.1669359874272; Thu, 24 Nov 2022 23:04:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669359874; cv=none; d=google.com; s=arc-20160816; b=EWqjNU+AepiTLwboaiW9beYfgSFMAJu0qYILw7NcnQWt9maWvK4kc1KzXaMbpfVD7p KQ4C7+HTAwLhtODb6g7m8bBs2mXFqNvGgrKxKSU7Y/nRyEWI7r6Ogy/ePkXCLhXpKDn+ wsi7Xd7KkicTfa4wA5FKj0nevddOVty8CGWATk4qsRMF8LcjTjBKJiclWaO7fsssiPxa pmviHsoDLSvpBu4AGxplNGZwqbkNDbAxfq+iHpVmTrY6I6hzUeEsB1Q5rpVCasVC2fPG Jj2dstHxQ41pFtvVETL8tF28azOfcL1FHhYj/KutDVuA4JkDRgNZ4sa37uleNohSAaIz E3CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ae4wxTG1QesfVYKAK9kgEaz+2sTnRMSKuQcSGkywipg=; b=xySFgiVyTjuUh27klYVENkPqbz7ESHARhGYHezVYdqo00Huxw0GPEhi+qANwvbI778 wxJJ0njg3RWGry+szcFmM+NiOd0+0lwIY9DTOleeDR2J7nJFJY9z+WRwMgqhVxwWZvC9 HoHc32vFJBaKXTTe0S7fbx+/dAt8aOtRZPmZ6Pp4fmDCu8jPef90QitBDZon1TCLmHtS NZzu1AyUdK7I7HItnxC+oMB1Hph30UUyutOV63CTFxTTxECYEEvs8O84Lc+0QZK4y5Co 8R5w6IITsF0eeh/OXRJoNdvcpSGoF2Wy7Ej7nxOgHVlNRCRdxcXYpFjdb74gC1SYB22c jm8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ob6-20020a17090b390600b00201d6d4cc79si4719643pjb.113.2022.11.24.23.04.12; Thu, 24 Nov 2022 23:04:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229598AbiKYGyy (ORCPT + 99 others); Fri, 25 Nov 2022 01:54:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbiKYGyx (ORCPT ); Fri, 25 Nov 2022 01:54:53 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2CD72B609 for ; Thu, 24 Nov 2022 22:54:51 -0800 (PST) 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750450699659693551?= X-GMAIL-MSGID: =?utf-8?q?1750450699659693551?= 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",