From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (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 E9AC1330D50 for ; Thu, 26 Mar 2026 08:21:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774513289; cv=none; b=XSPF+TIV3tOK/OaUnYNKQRENjupL2kvr+avwMJ9XSJeFkh+wMMMcH2HjuzECP0QVYmb1ym5ESD7d/2FeppsSQ3PX0WrDAWpc79tzrRdAM8OEzOIdySR+G84+jp78rVfMmnxmsYH9QYUD1SZG6tDN35smsjU2zaKN/Faozmld3t0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774513289; c=relaxed/simple; bh=rcEDgqTXLj7w+aLSwRXdbXR8qiATIgfpV8aJaBEEDkI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=j6+Mx8dqnGe+2kJJeXuiF/EU9SL5pkxs41wWzoM8p3EQuDNEleaYEA89ii4XZbNvTXMa7E5NtebAlaA6MOs637ZvD+vearhOmbJF6oDsk4JXVtQxnGzKWvCdSHsu6nbocupM1/YDD0zNbju0jus9M9szCmYz4vkdOYmR94heRus= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=JLzZh42X; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="JLzZh42X" Message-ID: <77ad6aa3-923a-47cc-9625-ed627c2ac9ed@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1774513286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wjPS8nNoUBDz2hTHGCQoOfGnhbBIjkw5dn0DefZiGfQ=; b=JLzZh42XhNyWURFwyTn4Yt/1OFjIeomUubGjMLnf8Y1EfyCvdr+a2dFCMPX/HlLv6XPKz8 GHbuZ4/s4xt7GLJZWjQ9z3wDc9s7+tTmS/7lSXUqH+0NQM1xRr0EJ4FCSAZBy2KFMXE6ph oQRBKdIzTX4cJpqKYsSLjs5owqlD+uE= Date: Thu, 26 Mar 2026 16:20:57 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 1/4] mm: memcontrol: correct the type of stats_updates to unsigned long To: "Lorenzo Stoakes (Oracle)" 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, 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 References: <158fa0b1296168047342f02050e9d2bda6888d27.1774447069.git.zhengqi.arch@bytedance.com> <3eb8b252-b6fa-4708-8c84-bf90142fe682@lucifer.local> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Qi Zheng In-Reply-To: <3eb8b252-b6fa-4708-8c84-bf90142fe682@lucifer.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 3/26/26 4:05 PM, Lorenzo Stoakes (Oracle) wrote: > On Thu, Mar 26, 2026 at 10:32:43AM +0800, Qi Zheng wrote: >> >> >> On 3/25/26 11:28 PM, Lorenzo Stoakes (Oracle) wrote: >>> On Wed, Mar 25, 2026 at 10:13:22PM +0800, Qi Zheng wrote: >>>> From: Qi Zheng >>>> >>>> The memcg_rstat_updated() tracks updates for vmstats_percpu->state >>>> and lruvec_stats_percpu->state. Since these state values are of type long, >>>> change the val parameter passed to memcg_rstat_updated() to long as well. >>>> >>>> Correspondingly, change the type of stats_updates in struct >>>> memcg_vmstats_percpu and struct memcg_vmstats from unsigned int and >>>> atomic_t to unsigned long and atomic_long_t respectively to prevent >>>> potential overflow when handling large state updates during the >>>> reparenting of LRU folios. >>> >>> Do we need a Fixes, possibly cc: stable for that? Apologies if already >>> asked + answered. >> >> Before LRU folio reparenting was introduced, we wouldn’t pass in such a >> large value, so this wasn’t a problem. Since LRU folio reparenting is >> still in mm-unstable, so I didn't add a Fixes tag in [4/4]. > > Ah, well these patches should be _before_ the LRU folio reparenting then? > > Andrew - can we ensure correct ordering here? There are some dependencies for this. To be precise, it should be applied after: [PATCH v6 29/33] mm: memcontrol: refactor mod_memcg_state() and mod_memcg_lruvec_state() and before: [PATCH v6 32/33] mm: memcontrol: eliminate the problem of dying memory cgroup for LRU folios and there might be conflicts. Would it be okay to merge them together into v7.1-rcX? Otherwise, perhaps updating to v7 would be more convenient for Andrew. Hi Andrew, what do you think? Thanks, Qi > >> >>> >>>> >>>> Signed-off-by: Qi Zheng >>> >>> Anyway logic seems fine to me, so: >>> >>> Reviewed-by: Lorenzo Stoakes (Oracle) >> >> Thanks! >> >> > > Thanks, Lorenzo