Commit 8dcb0ed8 authored by Shakeel Butt's avatar Shakeel Butt Committed by Tejun Heo
Browse files

memcg: cgroup: call css_rstat_updated irrespective of in_nmi()



css_rstat_updated() is nmi safe, so there is no need to avoid it in
in_nmi(), so remove the check.

Signed-off-by: default avatarShakeel Butt <shakeel.butt@linux.dev>
Tested-by: default avatarJP Kobryn <inwardvessel@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 6af89c6c
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -573,8 +573,6 @@ static inline void memcg_rstat_updated(struct mem_cgroup *memcg, int val,
	if (!val)
		return;

	/* TODO: add to cgroup update tree once it is nmi-safe. */
	if (!in_nmi())
	css_rstat_updated(&memcg->css, cpu);
	statc_pcpu = memcg->vmstats_percpu;
	for (; statc_pcpu; statc_pcpu = statc->parent_pcpu) {
@@ -2530,7 +2528,8 @@ static inline void account_slab_nmi_safe(struct mem_cgroup *memcg,
	} else {
		struct mem_cgroup_per_node *pn = memcg->nodeinfo[pgdat->node_id];

		/* 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 == NR_SLAB_RECLAIMABLE_B)
			atomic_add(nr, &pn->slab_reclaimable);
		else
@@ -2753,7 +2752,8 @@ static inline void account_kmem_nmi_safe(struct mem_cgroup *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);
	}
}