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 451EBC433F5 for ; Tue, 29 Mar 2022 14:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237699AbiC2OCo (ORCPT ); Tue, 29 Mar 2022 10:02:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237689AbiC2OCi (ORCPT ); Tue, 29 Mar 2022 10:02:38 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B205257 for ; Tue, 29 Mar 2022 07:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9SHlSe69XKJywaUZHcgPzspp3s6hKx2l886wiEn7ES8=; b=jXwe/J1NQBvLXRUmV6pPvMkg53 bUmqdNjzZLQRbietS4+6DM74R0vLPAOtc+KzY7lrOK5SlHTDuA9Q+h46+vUNjtwGbkJcXgH5FXooJ gj5CGaloYcZ8iIBcFkGh2JTkktXhhT51E6cRLFZSKEhXV94BADfStjDYT1B7+9c7jEhNzSYjG6WXL SwbLm3bBJodFxVcJUAcmDV7s+S4vjAm9lLLXz0U3Q1MKRPVoPxeDkSZENIBsy56OLf/Gefz3MB3sr bM3JyQmgn5mwnIk2YF3l9o+JRnYGq6wnOFHS5YGhpPWHE2LIThyx/xix2rbe0WpBRQSu8NiuUztsL k2SnznqA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZCOz-00CRPs-BJ; Tue, 29 Mar 2022 14:00:53 +0000 Date: Tue, 29 Mar 2022 07:00:53 -0700 From: Christoph Hellwig To: Miaohe Lin Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/8] mm/vmscan: save a bit of stack space in shrink_lruvec Message-ID: References: <20220329132619.18689-1-linmiaohe@huawei.com> <20220329132619.18689-5-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220329132619.18689-5-linmiaohe@huawei.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 29, 2022 at 09:26:15PM +0800, Miaohe Lin wrote: > 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 a6e60c78d058..ebd8ffb63673 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2862,8 +2862,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]; This looks like a problem waiting to happen..