From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 CE52713DBA0; Sun, 7 Jun 2026 10:27:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828044; cv=none; b=n1/5TdayV2Ngs6+/xwNEO+8VmF5PJSpb59zc3c8EN28u2ikT1kFQdGgHL5ueKz9BltTX+dvANoJswVBjpMlJVHIMWpQ626rr2w47QUJIpHCExiTA0YlFzN5sTDkYkCtqg1VxKJ7O1mlp2XlkDzN/UCBqZ7QKP0oS2q5/012pblE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828044; c=relaxed/simple; bh=ZH6vr0a4hDIyD1rfUv1B0mbqreQNZT7RWKVoUOcbPU0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DkmInysLYOFosOQxZeZrgAVo4Gryx9qPvrjTuGcyC8NSpWYJR5hevoQ3gkMfxR522dzGFYNyyVl+lOrYgKZezv7ZS+mbIZ7CYFPFTkvPbB4LoCstRmo/yn3MtyPMJ69lIJWdyuX0YY5B5/8lNreuHToySlSJgcgUctg7Ym6hgMk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=inYLF/Bq; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="inYLF/Bq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F6BF1F00893; Sun, 7 Jun 2026 10:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780828043; bh=rYRO317r3RDvQTX8Lo7TevHbMnCUWUsUFuYCLGEWNvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=inYLF/Bq+aqUoJDJCjvtXFifjqy9cds/Zsf5UVT2wqgxi6g9oWUPDrazsmXO7mZJV zqq5LACkSTo9X0fi74NUQDQvF9t2t6d96IYSsS5KwuEcbCZZfewB+95S3EWYpVqyeM IQZ1LfdPkY+PLyLkpzYkGFIiGXpl/2E4gBSOTh3Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexandre Ghiti , Shakeel Butt , Johannes Weiner , "Harry Yoo (Oracle)" , Michal Hocko , Muchun Song , Roman Gushchin , Andrew Morton Subject: [PATCH 6.18 123/315] mm: memcontrol: propagate NMI slab stats to memcg vmstats Date: Sun, 7 Jun 2026 11:58:30 +0200 Message-ID: <20260607095732.139902805@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.528828913@linuxfoundation.org> References: <20260607095727.528828913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexandre Ghiti commit e16f17a9c5af50221184d1ef4be4056bf3c4209e upstream. flush_nmi_stats() drains per-node NMI slab atomics into the per-node lruvec_stats, but does not propagate them to the memcg-level vmstats. For non NMI case, account_slab_nmi_safe() calls mod_memcg_lruvec_state() which updates both per-node lruvec_stats and memcg-level vmstats, so flush_nmi_stats() needs to flush to per-node lruvec_stats as well as memcg-level vmstats. So fix this by flushing to the memcg-level vmstats for NMI too. Link: https://lore.kernel.org/20260518082830.599102-1-alex@ghiti.fr Fixes: 940b01fc8dc1 ("memcg: nmi safe memcg stats for specific archs") Signed-off-by: Alexandre Ghiti Acked-by: Shakeel Butt Acked-by: Johannes Weiner Reviewed-by: Harry Yoo (Oracle) Cc: Michal Hocko Cc: Muchun Song Cc: Roman Gushchin Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/memcontrol.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4044,6 +4044,9 @@ static void flush_nmi_stats(struct mem_c lstats->state[index] += slab; if (plstats) plstats->state_pending[index] += slab; + memcg->vmstats->state[index] += slab; + if (parent) + parent->vmstats->state_pending[index] += slab; } if (atomic_read(&pn->slab_unreclaimable)) { int slab = atomic_xchg(&pn->slab_unreclaimable, 0); @@ -4052,6 +4055,9 @@ static void flush_nmi_stats(struct mem_c lstats->state[index] += slab; if (plstats) plstats->state_pending[index] += slab; + memcg->vmstats->state[index] += slab; + if (parent) + parent->vmstats->state_pending[index] += slab; } } }