Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96044
b: refs/heads/master
c: 712555e
h: refs/heads/master
v: v3
  • Loading branch information
Heiko Carstens authored and Ingo Molnar committed May 5, 2008
1 parent 548d8bd commit 86f2596
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 690229a0912ca2fef8b542fe4d8b73acfcdc6e24
refs/heads/master: 712555ee4f873515612f89554ad1a3fda5fa887e
29 changes: 12 additions & 17 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,12 @@ static void destroy_rt_bandwidth(struct rt_bandwidth *rt_b)
}
#endif

/*
* sched_domains_mutex serializes calls to arch_init_sched_domains,
* detach_destroy_domains and partition_sched_domains.
*/
static DEFINE_MUTEX(sched_domains_mutex);

#ifdef CONFIG_GROUP_SCHED

#include <linux/cgroup.h>
Expand Down Expand Up @@ -308,9 +314,6 @@ static DEFINE_PER_CPU(struct rt_rq, init_rt_rq) ____cacheline_aligned_in_smp;
*/
static DEFINE_SPINLOCK(task_group_lock);

/* doms_cur_mutex serializes access to doms_cur[] array */
static DEFINE_MUTEX(doms_cur_mutex);

#ifdef CONFIG_FAIR_GROUP_SCHED
#ifdef CONFIG_USER_SCHED
# define INIT_TASK_GROUP_LOAD (2*NICE_0_LOAD)
Expand Down Expand Up @@ -358,21 +361,9 @@ static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
#endif
}

static inline void lock_doms_cur(void)
{
mutex_lock(&doms_cur_mutex);
}

static inline void unlock_doms_cur(void)
{
mutex_unlock(&doms_cur_mutex);
}

#else

static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { }
static inline void lock_doms_cur(void) { }
static inline void unlock_doms_cur(void) { }

#endif /* CONFIG_GROUP_SCHED */

Expand Down Expand Up @@ -7822,7 +7813,7 @@ void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
{
int i, j;

lock_doms_cur();
mutex_lock(&sched_domains_mutex);

/* always unregister in case we don't destroy any domains */
unregister_sched_domain_sysctl();
Expand Down Expand Up @@ -7871,7 +7862,7 @@ void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,

register_sched_domain_sysctl();

unlock_doms_cur();
mutex_unlock(&sched_domains_mutex);
}

#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
Expand All @@ -7880,8 +7871,10 @@ int arch_reinit_sched_domains(void)
int err;

get_online_cpus();
mutex_lock(&sched_domains_mutex);
detach_destroy_domains(&cpu_online_map);
err = arch_init_sched_domains(&cpu_online_map);
mutex_unlock(&sched_domains_mutex);
put_online_cpus();

return err;
Expand Down Expand Up @@ -7999,10 +7992,12 @@ void __init sched_init_smp(void)
BUG_ON(sched_group_nodes_bycpu == NULL);
#endif
get_online_cpus();
mutex_lock(&sched_domains_mutex);
arch_init_sched_domains(&cpu_online_map);
cpus_andnot(non_isolated_cpus, cpu_possible_map, cpu_isolated_map);
if (cpus_empty(non_isolated_cpus))
cpu_set(smp_processor_id(), non_isolated_cpus);
mutex_unlock(&sched_domains_mutex);
put_online_cpus();
/* XXX: Theoretical race here - CPU may be hotplugged now */
hotcpu_notifier(update_sched_domains, 0);
Expand Down

0 comments on commit 86f2596

Please sign in to comment.