linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroup: rstat: call cgroup_rstat_updated_list with cgroup_rstat_lock
@ 2025-04-01 17:09 Shakeel Butt
  2025-04-01 17:33 ` Tejun Heo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shakeel Butt @ 2025-04-01 17:09 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Johannes Weiner, Michal Koutný,
	Yosry Ahmed, linux-mm, cgroups, linux-kernel, Meta kernel team,
	Jakub Kicinski, Breno Leitao, Venkat Rao Bagalkote

The commit 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and
locking") during cleanup accidentally changed the code to call
cgroup_rstat_updated_list() without cgroup_rstat_lock which is required.
Fix it.

Fixes: 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and locking")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Reported-by: Breno Leitao <leitao@debian.org>
Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Closes: https://lore.kernel.org/all/6564c3d6-9372-4352-9847-1eb3aea07ca4@linux.ibm.com/
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
---
 kernel/cgroup/rstat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
index 4bb587d5d34f..b2239156b7de 100644
--- a/kernel/cgroup/rstat.c
+++ b/kernel/cgroup/rstat.c
@@ -318,10 +318,11 @@ __bpf_kfunc void cgroup_rstat_flush(struct cgroup *cgrp)
 
 	might_sleep();
 	for_each_possible_cpu(cpu) {
-		struct cgroup *pos = cgroup_rstat_updated_list(cgrp, cpu);
+		struct cgroup *pos;
 
 		/* Reacquire for each CPU to avoid disabling IRQs too long */
 		__cgroup_rstat_lock(cgrp, cpu);
+		pos = cgroup_rstat_updated_list(cgrp, cpu);
 		for (; pos; pos = pos->rstat_flush_next) {
 			struct cgroup_subsys_state *css;
 
-- 
2.47.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: rstat: call cgroup_rstat_updated_list with cgroup_rstat_lock
  2025-04-01 17:09 [PATCH] cgroup: rstat: call cgroup_rstat_updated_list with cgroup_rstat_lock Shakeel Butt
@ 2025-04-01 17:33 ` Tejun Heo
  2025-04-01 21:37 ` Yosry Ahmed
  2025-04-02 11:40 ` Breno Leitao
  2 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2025-04-01 17:33 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Johannes Weiner, Michal Koutný,
	Yosry Ahmed, linux-mm, cgroups, linux-kernel, Meta kernel team,
	Jakub Kicinski, Breno Leitao, Venkat Rao Bagalkote

On Tue, Apr 01, 2025 at 10:09:12AM -0700, Shakeel Butt wrote:
> The commit 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and
> locking") during cleanup accidentally changed the code to call
> cgroup_rstat_updated_list() without cgroup_rstat_lock which is required.
> Fix it.
> 
> Fixes: 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and locking")
> Reported-by: Jakub Kicinski <kuba@kernel.org>
> Reported-by: Breno Leitao <leitao@debian.org>
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Closes: https://lore.kernel.org/all/6564c3d6-9372-4352-9847-1eb3aea07ca4@linux.ibm.com/
> Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>

Applied to cgroup/for-6.15-fixes.

Thanks.

-- 
tejun


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: rstat: call cgroup_rstat_updated_list with cgroup_rstat_lock
  2025-04-01 17:09 [PATCH] cgroup: rstat: call cgroup_rstat_updated_list with cgroup_rstat_lock Shakeel Butt
  2025-04-01 17:33 ` Tejun Heo
@ 2025-04-01 21:37 ` Yosry Ahmed
  2025-04-02 11:40 ` Breno Leitao
  2 siblings, 0 replies; 4+ messages in thread
From: Yosry Ahmed @ 2025-04-01 21:37 UTC (permalink / raw)
  To: Shakeel Butt, Tejun Heo
  Cc: Johannes Weiner, Michal Koutný,
	linux-mm, cgroups, linux-kernel, Meta kernel team,
	Jakub Kicinski, Breno Leitao, Venkat Rao Bagalkote

April 1, 2025 at 7:09 PM, "Shakeel Butt" <shakeel.butt@linux.dev> wrote:
> 
> The commit 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and
> locking") during cleanup accidentally changed the code to call
> cgroup_rstat_updated_list() without cgroup_rstat_lock which is required. 
> Fix it.
> 
> Fixes: 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and locking")
> Reported-by: Jakub Kicinski <kuba@kernel.org>
> Reported-by: Breno Leitao <leitao@debian.org>
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Closes: https://lore.kernel.org/all/6564c3d6-9372-4352-9847-1eb3aea07ca4@linux.ibm.com/
> Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>

Thanks for fixing this.

Reviewed-by: Yosry Ahmed <yosry.ahmed@linux.dev>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: rstat: call cgroup_rstat_updated_list with cgroup_rstat_lock
  2025-04-01 17:09 [PATCH] cgroup: rstat: call cgroup_rstat_updated_list with cgroup_rstat_lock Shakeel Butt
  2025-04-01 17:33 ` Tejun Heo
  2025-04-01 21:37 ` Yosry Ahmed
@ 2025-04-02 11:40 ` Breno Leitao
  2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2025-04-02 11:40 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Tejun Heo, Johannes Weiner, Michal Koutný,
	Yosry Ahmed, linux-mm, cgroups, linux-kernel, Meta kernel team,
	Jakub Kicinski, Venkat Rao Bagalkote

On Tue, Apr 01, 2025 at 10:09:12AM -0700, Shakeel Butt wrote:
> The commit 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and
> locking") during cleanup accidentally changed the code to call
> cgroup_rstat_updated_list() without cgroup_rstat_lock which is required.
> Fix it.
> 
> Fixes: 093c8812de2d ("cgroup: rstat: Cleanup flushing functions and locking")
> Reported-by: Jakub Kicinski <kuba@kernel.org>
> Reported-by: Breno Leitao <leitao@debian.org>
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Closes: https://lore.kernel.org/all/6564c3d6-9372-4352-9847-1eb3aea07ca4@linux.ibm.com/
> Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>

Tested-by: Breno Leitao <leitao@debian.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-02 11:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-01 17:09 [PATCH] cgroup: rstat: call cgroup_rstat_updated_list with cgroup_rstat_lock Shakeel Butt
2025-04-01 17:33 ` Tejun Heo
2025-04-01 21:37 ` Yosry Ahmed
2025-04-02 11:40 ` Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox