From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35C503EE1D5 for ; Tue, 24 Mar 2026 12:28:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774355291; cv=none; b=M3OkT1wXQf1GRzUx1oCMTy3QrnHJe9q3yEau2A4ZVYMoNCroR3oahgAk5hEVk8FgKIfNQjXNlk09ND5wM1OVBhSE+4Y8Ff5QCHQJtwzemk+caqM21epM7u2tSI6yPaJKvq2uFBtSD0XB8jxxd0n/RbVjS4au1ph8+Jg4SQ29U7E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774355291; c=relaxed/simple; bh=K1yw3A7DgEAUfWkAMhwo1R6Akouv6hzLeyyg1k5FtBg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WmRRXT9++ePQP2dPtzB5LlJF1dr1z4QbcF3zu2XmXbv4H/Up3gKKQw6gbqqYA+3DNCFBFFE7UHaSfwvCNh7qtMlcGkBYZLqJTdDdJJ6JN4QkoLzrL5UdbQDw8EhXOgVEo0rpdMJtVPHwrXI7WMKiucM/D3hZ8Y94JQPpcdocCEg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CChkzDRW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CChkzDRW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46579C19424; Tue, 24 Mar 2026 12:28:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774355290; bh=K1yw3A7DgEAUfWkAMhwo1R6Akouv6hzLeyyg1k5FtBg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CChkzDRWxDbXE0vBOO2ajMb9+ROGziGKBGXK0iNrwtZvThaRBbOnWWobALLRJg0qu wPjonLvy+1WB07i/h9s/dtZ0p9k2lN4tUOXemPsPojphBGcVGkjAHBRDYJaQovxZpr GhItk9bZ7jz1z2FHbeX9nRgssRcEgQCI1DW76/D31bv8kLbI5SUoTm3l6YJ7yR3ytt hePIpOBqrxjYKQpMNvwMbSHtsGPt7+NRfhPumIbV5CiowZBUZ5hU3DZ8QRem71ZWBW xOaR79nTzcVxu73ClIG6P6yM0QI3qefUFrq+NO9oDY3a9D2448DuhTvPn2Dvgf/6ey MJpv54nc3xPDA== Date: Tue, 24 Mar 2026 12:28:08 +0000 From: "Lorenzo Stoakes (Oracle)" To: Qi Zheng Cc: hannes@cmpxchg.org, hughd@google.com, mhocko@suse.com, roman.gushchin@linux.dev, shakeel.butt@linux.dev, muchun.song@linux.dev, david@kernel.org, lorenzo.stoakes@oracle.com, ziy@nvidia.com, harry.yoo@oracle.com, yosry.ahmed@linux.dev, imran.f.khan@oracle.com, kamalesh.babulal@oracle.com, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, chenridong@huaweicloud.com, mkoutny@suse.com, akpm@linux-foundation.org, hamzamahfooz@linux.microsoft.com, apais@linux.microsoft.com, lance.yang@linux.dev, bhe@redhat.com, usamaarif642@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: Re: [PATCH 3/3] mm: memcontrol: correct the nr_pages parameter type of mem_cgroup_update_lru_size() Message-ID: <641f8cfa-3a8a-439e-bf03-87af4c49ca2e@lucifer.local> References: <2cf06f9faf51900ce6acbb4740fc60355a2842ed.1774342371.git.zhengqi.arch@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2cf06f9faf51900ce6acbb4740fc60355a2842ed.1774342371.git.zhengqi.arch@bytedance.com> On Tue, Mar 24, 2026 at 07:31:29PM +0800, Qi Zheng wrote: > From: Qi Zheng > > The nr_pages parameter of mem_cgroup_update_lru_size() should clearly > be long instead of int, let's correct it. Hmm, but are you ever going to be adding that many pages? I guess technically correct though. You should list all the callers and how they use long or unsigned long, e.g. update_lru_sizes(), lruvec_reparent_lru(), lru_gen_reparent_memcg(). And maybe look a bit into why this was int, if there's any reason for it at all :) I'm assuming there's no weird 'let's intentionally let this overflow' behaviour here. > > Signed-off-by: Qi Zheng This one looks correct overall, so, with commit message improved: Reviewed-by: Lorenzo Stoakes (Oracle) > --- > include/linux/memcontrol.h | 2 +- > mm/memcontrol.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index 0861589695298..dc3fa687759b4 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -878,7 +878,7 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg) > } > > void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru, > - int zid, int nr_pages); > + int zid, long nr_pages); > > static inline > unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 4a78550f6174e..6491ca74b3398 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1466,7 +1466,7 @@ struct lruvec *folio_lruvec_lock_irqsave(struct folio *folio, > * to or just after a page is removed from an lru list. > */ > void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru, > - int zid, int nr_pages) > + int zid, long nr_pages) > { > struct mem_cgroup_per_node *mz; > unsigned long *lru_size; > -- > 2.20.1 >