mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	sched/ext: Use tg_cgroup() to elieminate duplicate code
Use tg_cgroup() to eliminate duplicate code patterns in scx_bpf_task_cgroup(). Signed-off-by: Zhang Qiao <zhangqiao22@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
		
							parent
							
								
									e418cd2b80
								
							
						
					
					
						commit
						161853a78b
					
				
					 1 changed files with 2 additions and 9 deletions
				
			
		| 
						 | 
					@ -7130,15 +7130,8 @@ __bpf_kfunc struct cgroup *scx_bpf_task_cgroup(struct task_struct *p)
 | 
				
			||||||
	if (!scx_kf_allowed_on_arg_tasks(__SCX_KF_RQ_LOCKED, p))
 | 
						if (!scx_kf_allowed_on_arg_tasks(__SCX_KF_RQ_LOCKED, p))
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						cgrp = tg_cgrp(tg);
 | 
				
			||||||
	 * A task_group may either be a cgroup or an autogroup. In the latter
 | 
					
 | 
				
			||||||
	 * case, @tg->css.cgroup is %NULL. A task_group can't become the other
 | 
					 | 
				
			||||||
	 * kind once created.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	if (tg && tg->css.cgroup)
 | 
					 | 
				
			||||||
		cgrp = tg->css.cgroup;
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		cgrp = &cgrp_dfl_root.cgrp;
 | 
					 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	cgroup_get(cgrp);
 | 
						cgroup_get(cgrp);
 | 
				
			||||||
	return cgrp;
 | 
						return cgrp;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue