From patchwork Fri Aug 19 03:34:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 12948276 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 D8775C28B2B for ; Fri, 19 Aug 2022 03:28:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 899888D0002; Thu, 18 Aug 2022 23:28:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D8B58E0001; Thu, 18 Aug 2022 23:28:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4ED1A8D0002; Thu, 18 Aug 2022 23:28:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 309D38D0003 for ; Thu, 18 Aug 2022 23:28:38 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E1D4BC020B for ; Fri, 19 Aug 2022 03:28:37 +0000 (UTC) X-FDA: 79814909874.12.BE9F55E Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf22.hostedemail.com (Postfix) with ESMTP id F30EEC0078 for ; Fri, 19 Aug 2022 03:28:35 +0000 (UTC) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4M86ZZ3dCBz1N7SG; Fri, 19 Aug 2022 11:25:10 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) 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.24; Fri, 19 Aug 2022 11:28:33 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 19 Aug 2022 11:28:33 +0800 From: Kefeng Wang To: Naoya Horiguchi , Miaohe Lin , Andrew Morton CC: , , Kefeng Wang Subject: [PATCH 1/2] mm: memory-failure: kill soft_offline_free_page() Date: Fri, 19 Aug 2022 11:34:01 +0800 Message-ID: <20220819033402.156519-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660879716; a=rsa-sha256; cv=none; b=xNgLluD7N3VahxmubukWYBGuOv+CU8x/ABIpcBGt5HE+ZGVFFSKBTTERRZrOc1vj5laeDF OcqRgUbWqhIfSWGGrJb9fXMGHrfQBQ+Q93IbsYvBGerIDYWPRZQ6leJndOku3I6nvQ30M4 G6r515PpO6DcD7DSXKkv31Ks8mEOI8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660879716; 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=m3tbaSKRGMDglQppPfP65xQpGSp07VjZnTUTiU0mD0w=; b=mFXb7TRwvEm1pDdHWZUzMnv5Bup0BJtTwIA8QnkPkI/8L6pBcqu8AJkhVFsRlxeNHko8fb gXNVGwR6jQ1AmPIrnsx8uC7y8wn/G0O4FLI9gito6rh34w+PdA205NMlDGDRe1KkTAxhkj E8ogfD3FTEBbJjRWdvhHKyekAnTAiYc= X-Rspamd-Queue-Id: F30EEC0078 Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam01 X-Rspam-User: X-Stat-Signature: 6tkf64u9c1jjharwzgqipp53xgwwxchg X-HE-Tag: 1660879715-382575 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: Open-code the page_handle_poison() into soft_offline_page() and kill unneeded soft_offline_free_page(). Signed-off-by: Kefeng Wang Acked-by: Naoya Horiguchi Reviewed-by: Miaohe Lin --- mm/memory-failure.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index e48f6f6a259d..1a7d6548ccb2 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2511,16 +2511,6 @@ static int soft_offline_in_use_page(struct page *page) return __soft_offline_page(page); } -static int soft_offline_free_page(struct page *page) -{ - int rc = 0; - - if (!page_handle_poison(page, true, false)) - rc = -EBUSY; - - return rc; -} - static void put_ref_page(struct page *page) { if (page) @@ -2598,7 +2588,7 @@ int soft_offline_page(unsigned long pfn, int flags) if (ret > 0) { ret = soft_offline_in_use_page(page); } else if (ret == 0) { - if (soft_offline_free_page(page) && try_again) { + if (!page_handle_poison(page, true, false) && try_again) { try_again = false; flags &= ~MF_COUNT_INCREASED; goto retry;