mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	sched_ext: Make scx_group_set_weight() always update tg->scx.weight
Otherwise, tg->scx.weight can go out of sync while scx_cgroup is not enabled
and ops.cgroup_init() may be called with a stale weight value.
Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 8195136669 ("sched_ext: Add cgroup support")
Cc: stable@vger.kernel.org # v6.12+
			
			
This commit is contained in:
		
							parent
							
								
									47096d301e
								
							
						
					
					
						commit
						c50784e99f
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -4241,12 +4241,12 @@ void scx_group_set_weight(struct task_group *tg, unsigned long weight)
 | 
			
		|||
 | 
			
		||||
	percpu_down_read(&scx_cgroup_rwsem);
 | 
			
		||||
 | 
			
		||||
	if (scx_cgroup_enabled && tg->scx_weight != weight) {
 | 
			
		||||
		if (SCX_HAS_OP(sch, cgroup_set_weight))
 | 
			
		||||
			SCX_CALL_OP(sch, SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
 | 
			
		||||
				    tg_cgrp(tg), weight);
 | 
			
		||||
		tg->scx_weight = weight;
 | 
			
		||||
	}
 | 
			
		||||
	if (scx_cgroup_enabled && SCX_HAS_OP(sch, cgroup_set_weight) &&
 | 
			
		||||
	    tg->scx_weight != weight)
 | 
			
		||||
		SCX_CALL_OP(sch, SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
 | 
			
		||||
			    tg_cgrp(tg), weight);
 | 
			
		||||
 | 
			
		||||
	tg->scx_weight = weight;
 | 
			
		||||
 | 
			
		||||
	percpu_up_read(&scx_cgroup_rwsem);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue