From patchwork Sat Apr 9 09:34:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12807805 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 38221C433FE for ; Sat, 9 Apr 2022 09:34:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C719C6B007B; Sat, 9 Apr 2022 05:34:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C22686B007D; Sat, 9 Apr 2022 05:34:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B11736B007E; Sat, 9 Apr 2022 05:34:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id A37AF6B007B for ; Sat, 9 Apr 2022 05:34:50 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7A75524EDE for ; Sat, 9 Apr 2022 09:34:50 +0000 (UTC) X-FDA: 79336831140.20.51271B0 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf10.hostedemail.com (Postfix) with ESMTP id 5EA45C0003 for ; Sat, 9 Apr 2022 09:34:47 +0000 (UTC) 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 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 X-Stat-Signature: w57jq591dfmijfobkdiqxsocmxojde8q Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5EA45C0003 X-HE-Tag: 1649496887-919099 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: 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;