lkml.org 
[lkml]   [2009]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC v4 PATCH 2/7] sched: Bandwidth initialization for fair task groups
From
Date
On Tue, 2009-11-17 at 20:04 +0530, Bharata B Rao wrote:

> +++ b/kernel/sched.c
> @@ -237,6 +237,15 @@ static DEFINE_MUTEX(sched_domains_mutex);
>
> #include <linux/cgroup.h>
>
> +#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_CFS_HARD_LIMITS)
> +struct cfs_bandwidth {
> + spinlock_t cfs_runtime_lock;
> + ktime_t cfs_period;
> + u64 cfs_runtime;
> + struct hrtimer cfs_period_timer;
> +};
> +#endif
> +
> struct cfs_rq;
>
> static LIST_HEAD(task_groups);

So what's wrong with using struct rt_bandwidth, aside from the name?

> @@ -445,6 +457,19 @@ struct cfs_rq {
> unsigned long rq_weight;
> #endif
> #endif
> +#ifdef CONFIG_CFS_HARD_LIMITS
> + /* set when the group is throttled on this cpu */
> + int cfs_throttled;
> +
> + /* runtime currently consumed by the group on this rq */
> + u64 cfs_time;
> +
> + /* runtime available to the group on this rq */
> + u64 cfs_runtime;
> +
> + /* Protects the cfs runtime related fields of this cfs_rq */
> + spinlock_t cfs_runtime_lock;
> +#endif
> };

If you put these 4 in a new struct, say rq_bandwidth, and also use that
for rt_rq, then I bet you can write patch 6 with a lot less copy/paste
action.



\
 
 \ /
  Last update: 2009-12-04 17:13    [from the cache]
©2003-2011 Jasper Spaans