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: 113651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8597905vqr; Tue, 27 Jun 2023 19:01:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ77h2hdsDFkDtr/bSVvsvzPdE/hWRWdNJ/NaNE/lfZJeNfkDs0Tuk9/NeY9cakVuILWVmb4 X-Received: by 2002:a17:903:1105:b0:1b3:ebda:654e with SMTP id n5-20020a170903110500b001b3ebda654emr39700799plh.5.1687917671156; Tue, 27 Jun 2023 19:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687917671; cv=none; d=google.com; s=arc-20160816; b=ZdEzbQIVV51KA8IbRRx3RE50Gys+nCXc/noqWXarupqnApYrcD5BFqAg0VEMP9qQGp RNXB8ithLhxf5dJv/DMnnkNOjR7sypVqDEU/xRz4dRalplrNbDuSFK+rt6sO//PtuPI6 nHSAp6t9EexbAvE5AFrshEegEzdaDjX5dDFY1tWqNAwEhmlLbhLLLrGyNMTTl4cjMJNL P5J6OfoRhHodM1kI33/9TRKvf0WGj3LXou0Qcu91PpEVqxmOjT9F39TrrKARM2Oz1P4/ m6LLntexGZGFR8sTpPkenUE1xAXc2TGUUAYbsq3udNOdC2zE/2SL4BEMvWir2eVZXPFo +S/A== 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=lBAMMW7ZrKoCKFCapkApb9PNrf+3sEv1WiQSsJGndI0=; fh=kP0L7jzW604qIlwIWwCV4xHGxfeYL9qfthvX96QEubA=; b=y72wx/HFs8l6gegi+2OWsA3OrBMgDbdkGXyJkki8Zfq30cThS1pbxBh5zmxr/kiMm7 8Fco9BOq57pYqOoJduO1jZLFVO1FrX/+R9A8EMLd60zUrzJZONZmwrWdjur4EE6gFwpc gewzogk00rZb+A1FvpOVfxv3OtxlYmdZotyAOEXB2zwqMCyR4XMTTpZONhEo6T7zyupt ZRK02Mgy1XScuBvLvZcrq0HNRVeI3jbeHkrchWEa3k11lgWWR+V9ONeRfwMxlmobyraw NdcI615dlKrYrNWkNTtCgnv54jTtqoB6V6490lgaWqKiOBReV3rPm4aTeXULjol92gWd 8wMQ== 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 u18-20020a170902a61200b001b5219acbbfsi8018550plq.359.2023.06.27.19.00.46; Tue, 27 Jun 2023 19:01:11 -0700 (PDT) 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 S230137AbjF1Bq6 (ORCPT + 99 others); Tue, 27 Jun 2023 21:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjF1Bq4 (ORCPT ); Tue, 27 Jun 2023 21:46:56 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B2C11BD7 for ; Tue, 27 Jun 2023 18:46:55 -0700 (PDT) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1769909946625231212?= X-GMAIL-MSGID: =?utf-8?q?1769909959812651512?= 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);