Lines Matching refs:tg
198 void unregister_rt_sched_group(struct task_group *tg) in unregister_rt_sched_group() argument
200 if (tg->rt_se) in unregister_rt_sched_group()
201 destroy_rt_bandwidth(&tg->rt_bandwidth); in unregister_rt_sched_group()
205 void free_rt_sched_group(struct task_group *tg) in free_rt_sched_group() argument
210 if (tg->rt_rq) in free_rt_sched_group()
211 kfree(tg->rt_rq[i]); in free_rt_sched_group()
212 if (tg->rt_se) in free_rt_sched_group()
213 kfree(tg->rt_se[i]); in free_rt_sched_group()
216 kfree(tg->rt_rq); in free_rt_sched_group()
217 kfree(tg->rt_se); in free_rt_sched_group()
220 void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq, in init_tg_rt_entry() argument
229 rt_rq->tg = tg; in init_tg_rt_entry()
231 tg->rt_rq[cpu] = rt_rq; in init_tg_rt_entry()
232 tg->rt_se[cpu] = rt_se; in init_tg_rt_entry()
247 int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent) in alloc_rt_sched_group() argument
253 tg->rt_rq = kcalloc(nr_cpu_ids, sizeof(rt_rq), GFP_KERNEL); in alloc_rt_sched_group()
254 if (!tg->rt_rq) in alloc_rt_sched_group()
256 tg->rt_se = kcalloc(nr_cpu_ids, sizeof(rt_se), GFP_KERNEL); in alloc_rt_sched_group()
257 if (!tg->rt_se) in alloc_rt_sched_group()
260 init_rt_bandwidth(&tg->rt_bandwidth, in alloc_rt_sched_group()
275 rt_rq->rt_runtime = tg->rt_bandwidth.rt_runtime; in alloc_rt_sched_group()
276 init_tg_rt_entry(tg, rt_rq, rt_se, i, parent->rt_se[i]); in alloc_rt_sched_group()
315 void unregister_rt_sched_group(struct task_group *tg) { } in unregister_rt_sched_group() argument
317 void free_rt_sched_group(struct task_group *tg) { } in free_rt_sched_group() argument
319 int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent) in alloc_rt_sched_group() argument
539 if (!rt_rq->tg) in sched_rt_runtime()
547 return ktime_to_ns(rt_rq->tg->rt_bandwidth.rt_period); in sched_rt_period()
552 static inline struct task_group *next_task_group(struct task_group *tg) in next_task_group() argument
555 tg = list_entry_rcu(tg->list.next, in next_task_group()
557 } while (&tg->list != &task_groups && task_group_is_autogroup(tg)); in next_task_group()
559 if (&tg->list == &task_groups) in next_task_group()
560 tg = NULL; in next_task_group()
562 return tg; in next_task_group()
589 rt_se = rt_rq->tg->rt_se[cpu]; in sched_rt_rq_enqueue()
607 rt_se = rt_rq->tg->rt_se[cpu]; in sched_rt_rq_dequeue()
655 return &rt_rq->tg->rt_bandwidth; in sched_rt_bandwidth()
1238 if (rt_rq->tg) in inc_rt_group()
1239 start_rt_bandwidth(&rt_rq->tg->rt_bandwidth); in inc_rt_group()
2839 static inline int tg_has_rt_tasks(struct task_group *tg) in tg_has_rt_tasks() argument
2848 if (task_group_is_autogroup(tg)) in tg_has_rt_tasks()
2851 css_task_iter_start(&tg->css, 0, &it); in tg_has_rt_tasks()
2860 struct task_group *tg; member
2865 static int tg_rt_schedulable(struct task_group *tg, void *data) in tg_rt_schedulable() argument
2872 period = ktime_to_ns(tg->rt_bandwidth.rt_period); in tg_rt_schedulable()
2873 runtime = tg->rt_bandwidth.rt_runtime; in tg_rt_schedulable()
2875 if (tg == d->tg) { in tg_rt_schedulable()
2890 tg->rt_bandwidth.rt_runtime && tg_has_rt_tasks(tg)) in tg_rt_schedulable()
2904 list_for_each_entry_rcu(child, &tg->children, siblings) { in tg_rt_schedulable()
2908 if (child == d->tg) { in tg_rt_schedulable()
2922 static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime) in __rt_schedulable() argument
2927 .tg = tg, in __rt_schedulable()
2939 static int tg_set_rt_bandwidth(struct task_group *tg, in tg_set_rt_bandwidth() argument
2948 if (tg == &root_task_group && rt_runtime == 0) in tg_set_rt_bandwidth()
2962 err = __rt_schedulable(tg, rt_period, rt_runtime); in tg_set_rt_bandwidth()
2966 raw_spin_lock_irq(&tg->rt_bandwidth.rt_runtime_lock); in tg_set_rt_bandwidth()
2967 tg->rt_bandwidth.rt_period = ns_to_ktime(rt_period); in tg_set_rt_bandwidth()
2968 tg->rt_bandwidth.rt_runtime = rt_runtime; in tg_set_rt_bandwidth()
2971 struct rt_rq *rt_rq = tg->rt_rq[i]; in tg_set_rt_bandwidth()
2977 raw_spin_unlock_irq(&tg->rt_bandwidth.rt_runtime_lock); in tg_set_rt_bandwidth()
2984 int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us) in sched_group_set_rt_runtime() argument
2988 rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period); in sched_group_set_rt_runtime()
2995 return tg_set_rt_bandwidth(tg, rt_period, rt_runtime); in sched_group_set_rt_runtime()
2998 long sched_group_rt_runtime(struct task_group *tg) in sched_group_rt_runtime() argument
3002 if (tg->rt_bandwidth.rt_runtime == RUNTIME_INF) in sched_group_rt_runtime()
3005 rt_runtime_us = tg->rt_bandwidth.rt_runtime; in sched_group_rt_runtime()
3010 int sched_group_set_rt_period(struct task_group *tg, u64 rt_period_us) in sched_group_set_rt_period() argument
3018 rt_runtime = tg->rt_bandwidth.rt_runtime; in sched_group_set_rt_period()
3020 return tg_set_rt_bandwidth(tg, rt_period, rt_runtime); in sched_group_set_rt_period()
3023 long sched_group_rt_period(struct task_group *tg) in sched_group_rt_period() argument
3027 rt_period_us = ktime_to_ns(tg->rt_bandwidth.rt_period); in sched_group_rt_period()
3045 int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk) in sched_rt_can_attach() argument
3048 if (rt_task(tsk) && tg->rt_bandwidth.rt_runtime == 0) in sched_rt_can_attach()