On Wed, Feb 2, 2011 at 12:47 PM, Kirill A. Shutsemov <kirill@xxxxxxxxxxxxx> wrote: > From: Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> > > Provides a way of tasks grouping by timer slack value. Introduces per > cgroup max and min timer slack value. When a task attaches to a cgroup, > its timer slack value adjusts (if needed) to fit min-max range. > > It also provides a way to set timer slack value for all tasks in the > cgroup at once. > > This functionality is useful in mobile devices where certain background > apps are attached to a cgroup and minimum wakeups are desired. If you really want to be able to make this modular, I'd be inclined to make the check_timer_slack hook just default to NULL, rather than introducing dummy_timer_slack_check() > + > +static int tslack_write_range(struct cgroup *cgroup, struct cftype *cft, > + u64 val) > +{ > + struct timer_slack_cgroup *tslack_cgroup; > + struct cgroup_iter it; > + struct task_struct *task; > + > + if (!val) > + return -EINVAL; > + > + tslack_cgroup = cgroup_to_tslack_cgroup(cgroup); > + switch (cft->private) { > + case TIMER_SLACK_MIN: > + if (val > tslack_cgroup->max_slack_ns) > + return -EINVAL; > + tslack_cgroup->min_slack_ns = val; > + break; > + case TIMER_SLACK_MAX: > + if (val < tslack_cgroup->min_slack_ns) > + return -EINVAL; > + tslack_cgroup->max_slack_ns = val; > + break; > + default: > + BUG(); > + } > + Don't we want to keep the min/max applied hierarchically as well? i.e. a child can't set its min/max outside the range of its parents? > + > +static int __init init_cgroup_timer_slack(void) > +{ > + BUG_ON(timer_slack_check != dummy_timer_slack_check); Better to make this just fail the initialization if someone else has already claimed the hook, rather than crashing. Paul _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers