From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7997EC433F5 for ; Sat, 9 Apr 2022 09:34:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234722AbiDIJg5 (ORCPT ); Sat, 9 Apr 2022 05:36:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241153AbiDIJgi (ORCPT ); Sat, 9 Apr 2022 05:36:38 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA927AFAD1 for ; Sat, 9 Apr 2022 02:34:32 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Kb9145pSrz1HBTl; Sat, 9 Apr 2022 17:34:00 +0800 (CST) Received: from huawei.com (10.175.124.27) 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.2375.24; Sat, 9 Apr 2022 17:34:30 +0800 From: Miaohe Lin To: CC: , , , , , , Subject: [PATCH v2 4/9] mm/vmscan: save a bit of stack space in shrink_lruvec Date: Sat, 9 Apr 2022 17:34:55 +0800 Message-ID: <20220409093500.10329-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220409093500.10329-1-linmiaohe@huawei.com> References: <20220409093500.10329-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org LRU_UNEVICTABLE is not taken into account when shrink lruvec. So we can save a bit of stack space by shrinking the array size of nr and targets to NR_LRU_LISTS - 1. No functional change intended. Signed-off-by: Miaohe Lin --- mm/vmscan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 59b96320f481..0e5818970998 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2881,8 +2881,9 @@ static bool can_age_anon_pages(struct pglist_data *pgdat, static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) { - unsigned long nr[NR_LRU_LISTS]; - unsigned long targets[NR_LRU_LISTS]; + /* LRU_UNEVICTABLE is not taken into account. */ + unsigned long nr[NR_LRU_LISTS - 1]; + unsigned long targets[NR_LRU_LISTS - 1]; unsigned long nr_to_scan; enum lru_list lru; unsigned long nr_reclaimed = 0; -- 2.23.0