diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2010-07-15 16:18:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-07-17 06:06:22 -0400 |
commit | 68c38fc3cb4e5a60f502ee9c45f3dfe70e5165ad (patch) | |
tree | 32293b2fd969c57032407294863c1f2ee6bf5996 | |
parent | bbc8cb5baead9607309583b20873ab0cc8d89eaf (diff) |
sched: No need for bootmem special cases
As of commit dcce284 ("mm: Extend gfp masking to the page
allocator") and commit 7e85ee0 ("slab,slub: don't enable
interrupts during early boot"), the slab allocator makes
sure we don't attempt to sleep during boot.
Therefore, remove bootmem special cases from the scheduler
and use plain GFP_KERNEL instead.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1279225102-2572-1-git-send-email-penberg@cs.helsinki.fi>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/sched.c | 19 | ||||
-rw-r--r-- | kernel/sched_cpupri.c | 8 | ||||
-rw-r--r-- | kernel/sched_cpupri.h | 2 |
3 files changed, 10 insertions, 19 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 9064e7d6ad65..7b443ee27be4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -6248,23 +6248,18 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd) | |||
6248 | free_rootdomain(old_rd); | 6248 | free_rootdomain(old_rd); |
6249 | } | 6249 | } |
6250 | 6250 | ||
6251 | static int init_rootdomain(struct root_domain *rd, bool bootmem) | 6251 | static int init_rootdomain(struct root_domain *rd) |
6252 | { | 6252 | { |
6253 | gfp_t gfp = GFP_KERNEL; | ||
6254 | |||
6255 | memset(rd, 0, sizeof(*rd)); | 6253 | memset(rd, 0, sizeof(*rd)); |
6256 | 6254 | ||
6257 | if (bootmem) | 6255 | if (!alloc_cpumask_var(&rd->span, GFP_KERNEL)) |
6258 | gfp = GFP_NOWAIT; | ||
6259 | |||
6260 | if (!alloc_cpumask_var(&rd->span, gfp)) | ||
6261 | goto out; | 6256 | goto out; |
6262 | if (!alloc_cpumask_var(&rd->online, gfp)) | 6257 | if (!alloc_cpumask_var(&rd->online, GFP_KERNEL)) |
6263 | goto free_span; | 6258 | goto free_span; |
6264 | if (!alloc_cpumask_var(&rd->rto_mask, gfp)) | 6259 | if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL)) |
6265 | goto free_online; | 6260 | goto free_online; |
6266 | 6261 | ||
6267 | if (cpupri_init(&rd->cpupri, bootmem) != 0) | 6262 | if (cpupri_init(&rd->cpupri) != 0) |
6268 | goto free_rto_mask; | 6263 | goto free_rto_mask; |
6269 | return 0; | 6264 | return 0; |
6270 | 6265 | ||
@@ -6280,7 +6275,7 @@ out: | |||
6280 | 6275 | ||
6281 | static void init_defrootdomain(void) | 6276 | static void init_defrootdomain(void) |
6282 | { | 6277 | { |
6283 | init_rootdomain(&def_root_domain, true); | 6278 | init_rootdomain(&def_root_domain); |
6284 | 6279 | ||
6285 | atomic_set(&def_root_domain.refcount, 1); | 6280 | atomic_set(&def_root_domain.refcount, 1); |
6286 | } | 6281 | } |
@@ -6293,7 +6288,7 @@ static struct root_domain *alloc_rootdomain(void) | |||
6293 | if (!rd) | 6288 | if (!rd) |
6294 | return NULL; | 6289 | return NULL; |
6295 | 6290 | ||
6296 | if (init_rootdomain(rd, false) != 0) { | 6291 | if (init_rootdomain(rd) != 0) { |
6297 | kfree(rd); | 6292 | kfree(rd); |
6298 | return NULL; | 6293 | return NULL; |
6299 | } | 6294 | } |
diff --git a/kernel/sched_cpupri.c b/kernel/sched_cpupri.c index e6871cb3fc83..2722dc1b4138 100644 --- a/kernel/sched_cpupri.c +++ b/kernel/sched_cpupri.c | |||
@@ -166,14 +166,10 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri) | |||
166 | * | 166 | * |
167 | * Returns: -ENOMEM if memory fails. | 167 | * Returns: -ENOMEM if memory fails. |
168 | */ | 168 | */ |
169 | int cpupri_init(struct cpupri *cp, bool bootmem) | 169 | int cpupri_init(struct cpupri *cp) |
170 | { | 170 | { |
171 | gfp_t gfp = GFP_KERNEL; | ||
172 | int i; | 171 | int i; |
173 | 172 | ||
174 | if (bootmem) | ||
175 | gfp = GFP_NOWAIT; | ||
176 | |||
177 | memset(cp, 0, sizeof(*cp)); | 173 | memset(cp, 0, sizeof(*cp)); |
178 | 174 | ||
179 | for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) { | 175 | for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) { |
@@ -181,7 +177,7 @@ int cpupri_init(struct cpupri *cp, bool bootmem) | |||
181 | 177 | ||
182 | raw_spin_lock_init(&vec->lock); | 178 | raw_spin_lock_init(&vec->lock); |
183 | vec->count = 0; | 179 | vec->count = 0; |
184 | if (!zalloc_cpumask_var(&vec->mask, gfp)) | 180 | if (!zalloc_cpumask_var(&vec->mask, GFP_KERNEL)) |
185 | goto cleanup; | 181 | goto cleanup; |
186 | } | 182 | } |
187 | 183 | ||
diff --git a/kernel/sched_cpupri.h b/kernel/sched_cpupri.h index 7cb5bb6b95be..9fc7d386fea4 100644 --- a/kernel/sched_cpupri.h +++ b/kernel/sched_cpupri.h | |||
@@ -27,7 +27,7 @@ struct cpupri { | |||
27 | int cpupri_find(struct cpupri *cp, | 27 | int cpupri_find(struct cpupri *cp, |
28 | struct task_struct *p, struct cpumask *lowest_mask); | 28 | struct task_struct *p, struct cpumask *lowest_mask); |
29 | void cpupri_set(struct cpupri *cp, int cpu, int pri); | 29 | void cpupri_set(struct cpupri *cp, int cpu, int pri); |
30 | int cpupri_init(struct cpupri *cp, bool bootmem); | 30 | int cpupri_init(struct cpupri *cp); |
31 | void cpupri_cleanup(struct cpupri *cp); | 31 | void cpupri_cleanup(struct cpupri *cp); |
32 | #else | 32 | #else |
33 | #define cpupri_set(cp, cpu, pri) do { } while (0) | 33 | #define cpupri_set(cp, cpu, pri) do { } while (0) |