From patchwork Wed Jun 28 01:46:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13295131 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 0730FC001B0 for ; Wed, 28 Jun 2023 01:47:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63ADC8D0002; Tue, 27 Jun 2023 21:47:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EAD18D0001; Tue, 27 Jun 2023 21:47:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D9408D0002; Tue, 27 Jun 2023 21:47:02 -0400 (EDT) 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 412058D0001 for ; Tue, 27 Jun 2023 21:47:02 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 11F51160A9E for ; Wed, 28 Jun 2023 01:47:02 +0000 (UTC) X-FDA: 80950468284.22.460B759 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf09.hostedemail.com (Postfix) with ESMTP id 08260140002 for ; Wed, 28 Jun 2023 01:46:57 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687916819; 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=lBAMMW7ZrKoCKFCapkApb9PNrf+3sEv1WiQSsJGndI0=; b=u1qiEz5KsDkIw+XAQaW8aFIVrYpPbMS+2ixGO6rJcd2lLsF35qBds9kaRDFdPkCW1JEb9Y vgC4vzriIPon5mVZ7DKakJi46ed0vYAzjMwNK28Ak/poWv1f/zvJe8s7C2ynDIb8fL1Blo I115PQRMEOuRgNlvuL30CwgCjHzhr8I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687916819; a=rsa-sha256; cv=none; b=HGwzmdZzkes29UqgSaVPvJYi6MDx/u1oKgix32tPkYsYoSdy8qiBsUZ3JchKKjzegWjN1f 48u7fGbDw2HobPjXjEtK5BR1nfq+vbujf/bYC4j4OBy68D1nHkHzHAoqJHP8DIXEz99deq fvBSt9/F6NBU3f2E88ThoSHxum/WcRs= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QrPXJ5qxxzLn6X; Wed, 28 Jun 2023 09:44:48 +0800 (CST) Received: from huawei.com (10.175.104.170) 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.2507.27; Wed, 28 Jun 2023 09:46:53 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH v2] mm: memory-failure: remove unneeded page state check in shake_page() Date: Wed, 28 Jun 2023 09:46:04 +0800 Message-ID: <20230628014604.3432146-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Stat-Signature: 757w6dopxhhfzjox8zaxi5tm9km1qg89 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 08260140002 X-Rspam-User: X-HE-Tag: 1687916817-254752 X-HE-Meta: U2FsdGVkX19eAPkXh4h0uEglbN1bXmzMJgrBk7xNETwZ8CebEaymsOLyuefBiGwUoa7zi5hmo0RWrbuYt2q/TqrcHjUgv0MJXodvQL4h3V2V+pAUsa2KK86iFPdxRSiQFgzTNEOxlt4j83ghvU8PxEDk8Q2FQ2gKu/Q4/eX0qLsAJDC8bFmST68iBZ/x3dvWiIQll6hSMbp096BL9/Uv5Ji0DAsLBSq6aDnrnC7vIENZho4JLkTUutHafk2a+lky/6ypB1920F3GzsKO/IKuoejl6gA+5IprQA55LZHc+W9L34mZtOSdgrxqL4WWVQ11APJ7OcFuZDAJTF5GSfs2s51CCt9y4AaCQ6IVLoTSbLvzay/8ocpwjFy4D0CM9Xnt7W3e61pdJn4BGyJ941rZuFwAFDNQNUuDG33HwWVjzukZpJSHB5T5y3oc/kgWNJ0G3ucdD8Ub0/g1gQlmVM0FwTkkC1o33x77sVjEiwhDPR38Vzn5qmez59UyJUmgZ2odQn7o7dJNEW3ENIuRprOFuKu1ImfI2EOC65oO3Dr+luOvV/F14hvrJPakiP4n1cskM2gjzbFs7VcEK/KTJ+27L4ZBSZwiGzRnWPNK7zvYqSZM3y26VTz4IFOD/J6zI//sS+ykJbQKqd6qpWcnjyYM6xrmiE3Wnl2M5cdBlSPiCOyOXTD/yr6aPn5RcpkJLsM+vY9T1kt8+UMTRB2EbKlKYmx7QdRih7vtql0ISHRlY6xHkc/wMYlUVqzKBwBgP5oR+Hf4miGX7Fy+G5tKoEtMqrWiNjA9hEchyMaFsRw2QfW/QLFBbSMqW7HbUmrxTtpEVsDMCxn8JrVJzqfPhVlqvArp8l//0RmYEGEp4o/buihKW5sc/1CTayz9sqJIPqigZvAtYXaGFOKPGdvB2BPYZquwTif2ZY0KOSsfMm1abvV1NgCvB2ac0wVb2qeh6aqJ+tuXCzkmwDtAzM19qdF 1Xn7upEd eLGowjiWFKqv1Nd9+iwCtM4aIBCYeEZOTyi18OtSRGEMD8Zt1TFXRzea+dKPKkqI7iGsOr2XpZQv6IYxeZAflXHGtUiFlHh7AiQx0nQDforbvrWbROHlaQgtc2eqCa6+ftIJ1cPLDQzKHH6veKOQ1EsPmULlwoHRol6hvjys0w4ZyGIRaobDqPDlJvYwpzTu3CniQ 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: Remove unneeded PageLRU(p) and is_free_buddy_page(p) check as slab caches are not shrunk now. This check can be added back when a lightweight range based shrinker is available. Signed-off-by: Miaohe Lin --- v2: put TODO comment together with "if (PageSlab)" block per Naoya collect Acked-by tag per Naoya --- mm/memory-failure.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 5b663eca1f29..66e7b3ceaf2d 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -372,17 +372,14 @@ void shake_page(struct page *p) { if (PageHuge(p)) return; - - if (!PageSlab(p)) { - lru_add_drain_all(); - if (PageLRU(p) || is_free_buddy_page(p)) - return; - } - /* * TODO: Could shrink slab caches here if a lightweight range-based * shrinker will be available. */ + if (PageSlab(p)) + return; + + lru_add_drain_all(); } EXPORT_SYMBOL_GPL(shake_page);