From nobody Sat Oct 11 04:07:54 2025 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (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 79F6E251792 for ; Wed, 11 Jun 2025 22:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749680184; cv=none; b=nm3tVINYC/+WLtlpQ4pKSs8ajQ6z4x7RrqgjzNchIlE7h8VQ+4SeINuVcDgjw4WjvZxLhSCrabCkUKMCNr1CQxRs3GnTrisffcOxkAaoyBuyoucnBfXqDgqTj9juMFDXNJDtr3n66JUpOj5IkYH2BeuC0xQTf4DjZtOyHGZnQ2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749680184; c=relaxed/simple; bh=oXikNS+kgN+2w3qPcZgZY0QITtEf/BerEbAt8eoZsE0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CA5xksxetJrzH886OFP59GZwX5AG79M063OGcZbK331wIawpD0jBALLmx+hbHCUVca6Vqg38x24X6XKF7yS0S3OZJPq0t/evO3JDgnjhSySg3QmTNVzTzpWYupuHnsUesEFq6wHPP3iyaLKGalKEwBhjm+SdjyYfh4TEuBXEPF8= 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=lSQxI91H; arc=none smtp.client-ip=95.215.58.189 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="lSQxI91H" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1749680180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ffjH9W3JevRTfPRrE/1Jq8fYf5w4/j5rXWB6dZVk6cA=; b=lSQxI91H5F+GlORNGReJtTn3xZcEGrrYKuBeb06a7HDXF5w6tidwKZRbwdRJGnI89e63/1 BY2mTqISo55dehhlwbfxDRY528tYIJ9xWj1x4rhM5/wHJr/3Zjvk97PkNmeT0/v/u3WBtd aKleVI3TXZiaCC0I4+dc0EulIJrxb4k= From: Shakeel Butt To: Tejun Heo , Andrew Morton Cc: JP Kobryn , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Vlastimil Babka , Alexei Starovoitov , Sebastian Andrzej Siewior , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Harry Yoo , Yosry Ahmed , bpf@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Meta kernel team Subject: [PATCH v2 4/4] memcg: cgroup: call css_rstat_updated irrespective of in_nmi() Date: Wed, 11 Jun 2025 15:15:32 -0700 Message-ID: <20250611221532.2513772-5-shakeel.butt@linux.dev> In-Reply-To: <20250611221532.2513772-1-shakeel.butt@linux.dev> References: <20250611221532.2513772-1-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" css_rstat_updated() is nmi safe, so there is no need to avoid it in in_nmi(), so remove the check. Signed-off-by: Shakeel Butt --- mm/memcontrol.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 902da8a9c643..d122bfe33e98 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -573,9 +573,7 @@ static inline void memcg_rstat_updated(struct mem_cgrou= p *memcg, int val, if (!val) return; =20 - /* TODO: add to cgroup update tree once it is nmi-safe. */ - if (!in_nmi()) - css_rstat_updated(&memcg->css, cpu); + css_rstat_updated(&memcg->css, cpu); statc_pcpu =3D memcg->vmstats_percpu; for (; statc_pcpu; statc_pcpu =3D statc->parent_pcpu) { statc =3D this_cpu_ptr(statc_pcpu); @@ -2530,7 +2528,8 @@ static inline void account_slab_nmi_safe(struct mem_c= group *memcg, } else { struct mem_cgroup_per_node *pn =3D memcg->nodeinfo[pgdat->node_id]; =20 - /* TODO: add to cgroup update tree once it is nmi-safe. */ + /* preemption is disabled in_nmi(). */ + css_rstat_updated(&memcg->css, smp_processor_id()); if (idx =3D=3D NR_SLAB_RECLAIMABLE_B) atomic_add(nr, &pn->slab_reclaimable); else @@ -2753,7 +2752,8 @@ static inline void account_kmem_nmi_safe(struct mem_c= group *memcg, int val) if (likely(!in_nmi())) { mod_memcg_state(memcg, MEMCG_KMEM, val); } else { - /* TODO: add to cgroup update tree once it is nmi-safe. */ + /* preemption is disabled in_nmi(). */ + css_rstat_updated(&memcg->css, smp_processor_id()); atomic_add(val, &memcg->kmem_stat); } } --=20 2.47.1