Lines Matching refs:tg

137 void free_rt_sched_group(struct task_group *tg)  in free_rt_sched_group()  argument
141 if (tg->rt_se) in free_rt_sched_group()
142 destroy_rt_bandwidth(&tg->rt_bandwidth); in free_rt_sched_group()
145 if (tg->rt_rq) in free_rt_sched_group()
146 kfree(tg->rt_rq[i]); in free_rt_sched_group()
147 if (tg->rt_se) in free_rt_sched_group()
148 kfree(tg->rt_se[i]); in free_rt_sched_group()
151 kfree(tg->rt_rq); in free_rt_sched_group()
152 kfree(tg->rt_se); in free_rt_sched_group()
155 void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq, in init_tg_rt_entry() argument
164 rt_rq->tg = tg; in init_tg_rt_entry()
166 tg->rt_rq[cpu] = rt_rq; in init_tg_rt_entry()
167 tg->rt_se[cpu] = rt_se; in init_tg_rt_entry()
182 int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent) in alloc_rt_sched_group() argument
188 tg->rt_rq = kcalloc(nr_cpu_ids, sizeof(rt_rq), GFP_KERNEL); in alloc_rt_sched_group()
189 if (!tg->rt_rq) in alloc_rt_sched_group()
191 tg->rt_se = kcalloc(nr_cpu_ids, sizeof(rt_se), GFP_KERNEL); in alloc_rt_sched_group()
192 if (!tg->rt_se) in alloc_rt_sched_group()
195 init_rt_bandwidth(&tg->rt_bandwidth, in alloc_rt_sched_group()
210 rt_rq->rt_runtime = tg->rt_bandwidth.rt_runtime; in alloc_rt_sched_group()
211 init_tg_rt_entry(tg, rt_rq, rt_se, i, parent->rt_se[i]); in alloc_rt_sched_group()
250 void free_rt_sched_group(struct task_group *tg) { } in free_rt_sched_group() argument
252 int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent) in alloc_rt_sched_group() argument
443 if (!rt_rq->tg) in sched_rt_runtime()
451 return ktime_to_ns(rt_rq->tg->rt_bandwidth.rt_period); in sched_rt_period()
456 static inline struct task_group *next_task_group(struct task_group *tg) in next_task_group() argument
459 tg = list_entry_rcu(tg->list.next, in next_task_group()
461 } while (&tg->list != &task_groups && task_group_is_autogroup(tg)); in next_task_group()
463 if (&tg->list == &task_groups) in next_task_group()
464 tg = NULL; in next_task_group()
466 return tg; in next_task_group()
493 rt_se = rt_rq->tg->rt_se[cpu]; in sched_rt_rq_enqueue()
511 rt_se = rt_rq->tg->rt_se[cpu]; in sched_rt_rq_dequeue()
559 return &rt_rq->tg->rt_bandwidth; in sched_rt_bandwidth()
1129 if (rt_rq->tg) in inc_rt_group()
1130 start_rt_bandwidth(&rt_rq->tg->rt_bandwidth); in inc_rt_group()
2416 static inline int tg_has_rt_tasks(struct task_group *tg) in tg_has_rt_tasks() argument
2423 if (task_group_is_autogroup(tg)) in tg_has_rt_tasks()
2427 if (rt_task(p) && task_group(p) == tg) in tg_has_rt_tasks()
2435 struct task_group *tg; member
2440 static int tg_rt_schedulable(struct task_group *tg, void *data) in tg_rt_schedulable() argument
2447 period = ktime_to_ns(tg->rt_bandwidth.rt_period); in tg_rt_schedulable()
2448 runtime = tg->rt_bandwidth.rt_runtime; in tg_rt_schedulable()
2450 if (tg == d->tg) { in tg_rt_schedulable()
2464 if (rt_bandwidth_enabled() && !runtime && tg_has_rt_tasks(tg)) in tg_rt_schedulable()
2478 list_for_each_entry_rcu(child, &tg->children, siblings) { in tg_rt_schedulable()
2482 if (child == d->tg) { in tg_rt_schedulable()
2496 static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime) in __rt_schedulable() argument
2501 .tg = tg, in __rt_schedulable()
2513 static int tg_set_rt_bandwidth(struct task_group *tg, in tg_set_rt_bandwidth() argument
2522 if (tg == &root_task_group && rt_runtime == 0) in tg_set_rt_bandwidth()
2531 err = __rt_schedulable(tg, rt_period, rt_runtime); in tg_set_rt_bandwidth()
2535 raw_spin_lock_irq(&tg->rt_bandwidth.rt_runtime_lock); in tg_set_rt_bandwidth()
2536 tg->rt_bandwidth.rt_period = ns_to_ktime(rt_period); in tg_set_rt_bandwidth()
2537 tg->rt_bandwidth.rt_runtime = rt_runtime; in tg_set_rt_bandwidth()
2540 struct rt_rq *rt_rq = tg->rt_rq[i]; in tg_set_rt_bandwidth()
2546 raw_spin_unlock_irq(&tg->rt_bandwidth.rt_runtime_lock); in tg_set_rt_bandwidth()
2554 int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us) in sched_group_set_rt_runtime() argument
2558 rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period); in sched_group_set_rt_runtime()
2563 return tg_set_rt_bandwidth(tg, rt_period, rt_runtime); in sched_group_set_rt_runtime()
2566 long sched_group_rt_runtime(struct task_group *tg) in sched_group_rt_runtime() argument
2570 if (tg->rt_bandwidth.rt_runtime == RUNTIME_INF) in sched_group_rt_runtime()
2573 rt_runtime_us = tg->rt_bandwidth.rt_runtime; in sched_group_rt_runtime()
2578 int sched_group_set_rt_period(struct task_group *tg, u64 rt_period_us) in sched_group_set_rt_period() argument
2583 rt_runtime = tg->rt_bandwidth.rt_runtime; in sched_group_set_rt_period()
2585 return tg_set_rt_bandwidth(tg, rt_period, rt_runtime); in sched_group_set_rt_period()
2588 long sched_group_rt_period(struct task_group *tg) in sched_group_rt_period() argument
2592 rt_period_us = ktime_to_ns(tg->rt_bandwidth.rt_period); in sched_group_rt_period()
2610 int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk) in sched_rt_can_attach() argument
2613 if (rt_task(tsk) && tg->rt_bandwidth.rt_runtime == 0) in sched_rt_can_attach()