diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 65204845063e..72c194c55c31 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -7023,7 +7023,8 @@ static void __free_domain_allocs(struct s_data *d, enum s_alloc what, | |||
7023 | 7023 | ||
7024 | switch (what) { | 7024 | switch (what) { |
7025 | case sa_rootdomain: | 7025 | case sa_rootdomain: |
7026 | free_rootdomain(&d->rd->rcu); /* fall through */ | 7026 | if (!atomic_read(&d->rd->refcount)) |
7027 | free_rootdomain(&d->rd->rcu); /* fall through */ | ||
7027 | case sa_sd: | 7028 | case sa_sd: |
7028 | free_percpu(d->sd); /* fall through */ | 7029 | free_percpu(d->sd); /* fall through */ |
7029 | case sa_sd_storage: | 7030 | case sa_sd_storage: |
@@ -7208,7 +7209,7 @@ static int build_sched_domains(const struct cpumask *cpu_map, | |||
7208 | enum s_alloc alloc_state = sa_none; | 7209 | enum s_alloc alloc_state = sa_none; |
7209 | struct sched_domain *sd; | 7210 | struct sched_domain *sd; |
7210 | struct s_data d; | 7211 | struct s_data d; |
7211 | int i; | 7212 | int i, ret = -ENOMEM; |
7212 | 7213 | ||
7213 | alloc_state = __visit_domain_allocation_hell(&d, cpu_map); | 7214 | alloc_state = __visit_domain_allocation_hell(&d, cpu_map); |
7214 | if (alloc_state != sa_rootdomain) | 7215 | if (alloc_state != sa_rootdomain) |
@@ -7261,12 +7262,10 @@ static int build_sched_domains(const struct cpumask *cpu_map, | |||
7261 | } | 7262 | } |
7262 | rcu_read_unlock(); | 7263 | rcu_read_unlock(); |
7263 | 7264 | ||
7264 | __free_domain_allocs(&d, sa_sd, cpu_map); | 7265 | ret = 0; |
7265 | return 0; | ||
7266 | |||
7267 | error: | 7266 | error: |
7268 | __free_domain_allocs(&d, alloc_state, cpu_map); | 7267 | __free_domain_allocs(&d, alloc_state, cpu_map); |
7269 | return -ENOMEM; | 7268 | return ret; |
7270 | } | 7269 | } |
7271 | 7270 | ||
7272 | static cpumask_var_t *doms_cur; /* current sched domains */ | 7271 | static cpumask_var_t *doms_cur; /* current sched domains */ |