Lines Matching refs:tg

3874 static struct cgroup *tg_cgrp(struct task_group *tg)
3877 * If CGROUP_SCHED is disabled, @tg is NULL. If @tg is an autogroup,
3878 * @tg->css.cgroup is NULL. In both cases, @tg can be treated as the
3881 if (tg && tg->css.cgroup)
3882 return tg->css.cgroup;
4777 void scx_tg_init(struct task_group *tg)
4779 tg->scx.weight = CGROUP_WEIGHT_DFL;
4780 tg->scx.bw_period_us = default_bw_period_us();
4781 tg->scx.bw_quota_us = RUNTIME_INF;
4782 tg->scx.idle = false;
4787 * @tg: task_group of interest
4789 * Return the sched that @tg's ops.cgroup_init() succeeded on, %NULL if @tg
4790 * isn't inited. An autogroup tg has no cgroup of its own and resolves to the
4798 * Safe for callers read-locking the ops rwsem. tg->scx.sched rewrites
4799 * write-lock it, and tg on/offline can't overlap such callers as a css's files
4802 static struct scx_sched *scx_tg_sched(struct task_group *tg)
4807 if (!tg->css.cgroup)
4808 tg = &root_task_group;
4809 /* INITED means ops.cgroup_init() succeeded on @tg->scx.sched */
4810 return (tg->scx.flags & SCX_TG_INITED) ? tg->scx.sched : NULL;
4815 * @tg: task_group of interest
4818 * parent task_group's sched, which equals @tg's own sched everywhere except
4825 * The callers sit in @tg's cgroup file writes holding the ops rwsem read
4829 static struct scx_sched *scx_tg_knob_sched(struct task_group *tg)
4834 if (!tg->css.cgroup || !tg->css.parent)
4836 return scx_tg_sched(css_tg(tg->css.parent));
4839 int scx_tg_online(struct task_group *tg)
4843 WARN_ON_ONCE(tg->scx.flags & (SCX_TG_ONLINE | SCX_TG_INITED));
4854 if (cgroup_on_dfl(tg->css.cgroup))
4855 sch = scx_cgroup_sched(tg->css.cgroup);
4861 { .weight = tg->scx.weight,
4862 .bw_period_us = tg->scx.bw_period_us,
4863 .bw_quota_us = tg->scx.bw_quota_us,
4864 .bw_burst_us = tg->scx.bw_burst_us,
4865 .sched_idle = tg->scx.idle };
4868 NULL, tg->css.cgroup, &args);
4873 tg->scx.sched = sch;
4874 tg->scx.flags |= SCX_TG_ONLINE | SCX_TG_INITED;
4877 tg->scx.flags |= SCX_TG_ONLINE;
4883 void scx_tg_offline(struct task_group *tg)
4885 struct scx_sched *sch = tg->scx.sched;
4887 WARN_ON_ONCE(!(tg->scx.flags & SCX_TG_ONLINE));
4890 if (scx_cgroup_enabled && (tg->scx.flags & SCX_TG_INITED) &&
4892 SCX_CALL_OP(sch, cgroup_exit, NULL, tg->css.cgroup);
4893 tg->scx.sched = NULL;
4894 tg->scx.flags &= ~(SCX_TG_ONLINE | SCX_TG_INITED);
5008 void scx_group_set_weight(struct task_group *tg, unsigned long weight)
5013 sch = scx_tg_knob_sched(tg);
5016 tg->scx.weight != weight)
5017 SCX_CALL_OP(sch, cgroup_set_weight, NULL, tg_cgrp(tg), weight);
5019 tg->scx.weight = weight;
5024 void scx_group_set_idle(struct task_group *tg, bool idle)
5029 sch = scx_tg_knob_sched(tg);
5032 tg->scx.idle != idle)
5033 SCX_CALL_OP(sch, cgroup_set_idle, NULL, tg_cgrp(tg), idle);
5036 tg->scx.idle = idle;
5041 void scx_group_set_bandwidth(struct task_group *tg,
5047 sch = scx_tg_knob_sched(tg);
5050 (tg->scx.bw_period_us != period_us ||
5051 tg->scx.bw_quota_us != quota_us ||
5052 tg->scx.bw_burst_us != burst_us))
5054 tg_cgrp(tg), period_us, quota_us, burst_us);
5056 tg->scx.bw_period_us = period_us;
5057 tg->scx.bw_quota_us = quota_us;
5058 tg->scx.bw_burst_us = burst_us;
5254 struct task_group *tg = css_tg(css);
5257 tg->scx.sched = NULL;
5258 if (tg->scx.flags & SCX_TG_INITED) {
5259 tg->scx.flags &= ~SCX_TG_INITED;
5276 struct task_group *tg = css_tg(css);
5278 if ((tg->scx.flags & (SCX_TG_ONLINE | SCX_TG_INITED)) != SCX_TG_ONLINE)
5283 .weight = tg->scx.weight,
5284 .bw_period_us = tg->scx.bw_period_us,
5285 .bw_quota_us = tg->scx.bw_quota_us,
5286 .bw_burst_us = tg->scx.bw_burst_us,
5287 .sched_idle = tg->scx.idle,
5297 tg->scx.sched = sch;
5298 tg->scx.flags |= SCX_TG_INITED;
10802 struct task_group *tg = p->sched_task_group;
10815 cgrp = tg_cgrp(tg);