From patchwork Wed Jun 28 01:49:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 113653 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8605347vqr; Tue, 27 Jun 2023 19:18:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4kwVkL1zNEC42fmh1vjod+VnL58XFEjGKAHUKpwknQL3B1zsYLIhaHr0wJNbzcZQXG7WZR X-Received: by 2002:a05:6a20:7d8e:b0:116:696f:1dd1 with SMTP id v14-20020a056a207d8e00b00116696f1dd1mr5037851pzj.4.1687918730297; Tue, 27 Jun 2023 19:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687918730; cv=none; d=google.com; s=arc-20160816; b=kNABVfi1JsXrqoCLJ1DCogw1vOgEbs1p/3ezROEg4j0fp6qC3qnr0c+q0SPSp56YOy o6eUXaZNhyi5ynWl3QKfzidjE5x0uNHiKRPQ4JM+DAdcMVIsqTHLo0RDByo2oqEEmKXY BB8CZRd3s0ExhNMd0E+czbQGnK5LfHSdYQMbbZCgkpNX9/+GaDrXxkMhUjt5v2uv3A1x +OsadGjC3UNytGd3f0EkLvx805lSf4e0bFF2vnqxHh2tcSbCJ09gwHECXiCoojwjsaQv BDK7R8DkTJlIABzsNLrm6Zu3vi9fhFtEdK/t1qZhWmVBztdYKbM3o/LAeHBD5cGYziYm kDgg== 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=0vFlJfX/d8pMFvnjJOUGNMFQFyTbAnyocH2dgytbhoI=; fh=kP0L7jzW604qIlwIWwCV4xHGxfeYL9qfthvX96QEubA=; b=BG6YSCSTtVguT5wpHnaE/xmukevmm5oU0An2PuT9JgrxspfPnq7jhHautrBn8OaIF1 b4eugISIFYPuDUBVSaW1n3E82TO0JaWkMrw58zyYfTTcYcwER7qq9Nhbv6LcPdfZFzYy JgrwS4i2pkWGWXG0tRPSryufGKrZWCsnvciZHtaboyT/LNMMcXfbdiqmyqBglYwIetO/ 3Okd3aHm6FfAloBqUZjKZ3r53+Fy458IhUtR5MBhsCxMVhfs7k6E81VPk0mK8ByBRwmk drp3DCvO8ZnTc4RFiWs8qrHwlprJqrgbbodAZfVeV15WEfxLQekvw5URG5v5/kEMalgc qWtA== 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 y2-20020a636402000000b005098590f1edsi8031181pgb.757.2023.06.27.19.18.35; Tue, 27 Jun 2023 19:18:50 -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 S231139AbjF1BuW (ORCPT + 99 others); Tue, 27 Jun 2023 21:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231166AbjF1BuU (ORCPT ); Tue, 27 Jun 2023 21:50:20 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C62D26A3 for ; Tue, 27 Jun 2023 18:50:18 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QrPcC2653zLmgr; Wed, 28 Jun 2023 09:48:11 +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:50:15 +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:49:29 +0800 Message-ID: <20230628014929.3441386-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?1769911070746663135?= 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 Acked-by: Naoya Horiguchi --- 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);