* [PATCH 2/2] sched: use slab in cpupri_init()
@ 2009-06-11 5:46 Pekka J Enberg
2009-06-11 6:10 ` Li Zefan
0 siblings, 1 reply; 6+ messages in thread
From: Pekka J Enberg @ 2009-06-11 5:46 UTC (permalink / raw)
To: linux-kernel, mingo, torvalds, yinghai
From: Pekka Enberg <penberg@cs.helsinki.fi>
Lets not use the bootmem allocator in cpupri_init() as slab is already up when
it is run.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
kernel/sched.c | 2 +-
kernel/sched_cpupri.c | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 12cc09c..dcf2dc2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7795,7 +7795,7 @@ static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)
if (!alloc_cpumask_var(&rd->rto_mask, gfp))
goto free_online;
- if (cpupri_init(&rd->cpupri, false) != 0)
+ if (cpupri_init(&rd->cpupri, bootmem) != 0)
goto free_rto_mask;
return 0;
diff --git a/kernel/sched_cpupri.c b/kernel/sched_cpupri.c
index 344712a..7deffc9 100644
--- a/kernel/sched_cpupri.c
+++ b/kernel/sched_cpupri.c
@@ -154,8 +154,12 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri)
*/
int __init_refok cpupri_init(struct cpupri *cp, bool bootmem)
{
+ gfp_t gfp = GFP_KERNEL;
int i;
+ if (bootmem)
+ gfp = GFP_NOWAIT;
+
memset(cp, 0, sizeof(*cp));
for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) {
@@ -163,9 +167,7 @@ int __init_refok cpupri_init(struct cpupri *cp, bool bootmem)
spin_lock_init(&vec->lock);
vec->count = 0;
- if (bootmem)
- alloc_bootmem_cpumask_var(&vec->mask);
- else if (!zalloc_cpumask_var(&vec->mask, GFP_KERNEL))
+ if (!zalloc_cpumask_var(&vec->mask, gfp))
goto cleanup;
}
--
1.6.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] sched: use slab in cpupri_init()
2009-06-11 5:46 [PATCH 2/2] sched: use slab in cpupri_init() Pekka J Enberg
@ 2009-06-11 6:10 ` Li Zefan
2009-06-11 7:24 ` Pekka Enberg
0 siblings, 1 reply; 6+ messages in thread
From: Li Zefan @ 2009-06-11 6:10 UTC (permalink / raw)
To: Pekka J Enberg; +Cc: linux-kernel, mingo, torvalds, yinghai
> @@ -163,9 +167,7 @@ int __init_refok cpupri_init(struct cpupri *cp, bool bootmem)
so the __init_refok tag can be removed, no?
>
> spin_lock_init(&vec->lock);
> vec->count = 0;
> - if (bootmem)
> - alloc_bootmem_cpumask_var(&vec->mask);
> - else if (!zalloc_cpumask_var(&vec->mask, GFP_KERNEL))
> + if (!zalloc_cpumask_var(&vec->mask, gfp))
> goto cleanup;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] sched: use slab in cpupri_init()
2009-06-11 6:10 ` Li Zefan
@ 2009-06-11 7:24 ` Pekka Enberg
2009-06-11 7:37 ` Li Zefan
0 siblings, 1 reply; 6+ messages in thread
From: Pekka Enberg @ 2009-06-11 7:24 UTC (permalink / raw)
To: Li Zefan; +Cc: linux-kernel, mingo, torvalds, yinghai
Hi Li!
On Thu, 2009-06-11 at 14:10 +0800, Li Zefan wrote:
> > @@ -163,9 +167,7 @@ int __init_refok cpupri_init(struct cpupri *cp, bool bootmem)
>
> so the __init_refok tag can be removed, no?
I am not sure how this is related to my patch but as long as
init_rootdomain() has it, cpupri_init() should too AFAICT.
Pekka
> >
> > spin_lock_init(&vec->lock);
> > vec->count = 0;
> > - if (bootmem)
> > - alloc_bootmem_cpumask_var(&vec->mask);
> > - else if (!zalloc_cpumask_var(&vec->mask, GFP_KERNEL))
> > + if (!zalloc_cpumask_var(&vec->mask, gfp))
> > goto cleanup;
> > }
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] sched: use slab in cpupri_init()
2009-06-11 7:24 ` Pekka Enberg
@ 2009-06-11 7:37 ` Li Zefan
2009-06-11 7:37 ` Pekka Enberg
0 siblings, 1 reply; 6+ messages in thread
From: Li Zefan @ 2009-06-11 7:37 UTC (permalink / raw)
To: Pekka Enberg; +Cc: linux-kernel, mingo, torvalds, yinghai
Pekka Enberg wrote:
> Hi Li!
>
> On Thu, 2009-06-11 at 14:10 +0800, Li Zefan wrote:
>>> @@ -163,9 +167,7 @@ int __init_refok cpupri_init(struct cpupri *cp, bool bootmem)
>> so the __init_refok tag can be removed, no?
>
> I am not sure how this is related to my patch but as long as
> init_rootdomain() has it, cpupri_init() should too AFAICT.
>
cpupri_init() is marked as __init_refok, because it calls
alloc_bootmem_cpumask_var() not because init_rootdomain()
has the tag. Now this patch removes this function call,
so the tag is no long needed.
>
>>>
>>> spin_lock_init(&vec->lock);
>>> vec->count = 0;
>>> - if (bootmem)
>>> - alloc_bootmem_cpumask_var(&vec->mask);
>>> - else if (!zalloc_cpumask_var(&vec->mask, GFP_KERNEL))
>>> + if (!zalloc_cpumask_var(&vec->mask, gfp))
>>> goto cleanup;
>>> }
>>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] sched: use slab in cpupri_init()
2009-06-11 7:37 ` Li Zefan
@ 2009-06-11 7:37 ` Pekka Enberg
2009-06-11 7:50 ` Li Zefan
0 siblings, 1 reply; 6+ messages in thread
From: Pekka Enberg @ 2009-06-11 7:37 UTC (permalink / raw)
To: Li Zefan; +Cc: linux-kernel, mingo, torvalds, yinghai
On Thu, 2009-06-11 at 15:37 +0800, Li Zefan wrote:
> cpupri_init() is marked as __init_refok, because it calls
> alloc_bootmem_cpumask_var() not because init_rootdomain()
> has the tag. Now this patch removes this function call,
> so the tag is no long needed.
Aah, OK, makes sense. Care to send a patch to Ingo once we have this
thing merged?
Pekka
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] sched: use slab in cpupri_init()
2009-06-11 7:37 ` Pekka Enberg
@ 2009-06-11 7:50 ` Li Zefan
0 siblings, 0 replies; 6+ messages in thread
From: Li Zefan @ 2009-06-11 7:50 UTC (permalink / raw)
To: Pekka Enberg; +Cc: linux-kernel, mingo, torvalds, yinghai
Pekka Enberg wrote:
> On Thu, 2009-06-11 at 15:37 +0800, Li Zefan wrote:
>> cpupri_init() is marked as __init_refok, because it calls
>> alloc_bootmem_cpumask_var() not because init_rootdomain()
>> has the tag. Now this patch removes this function call,
>> so the tag is no long needed.
>
> Aah, OK, makes sense. Care to send a patch to Ingo once we have this
> thing merged?
>
OK. Actually it's me that added it. ;)
(see db2f59c8c9b315f2b88b1dac159b988c6009034d)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-06-11 7:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-11 5:46 [PATCH 2/2] sched: use slab in cpupri_init() Pekka J Enberg
2009-06-11 6:10 ` Li Zefan
2009-06-11 7:24 ` Pekka Enberg
2009-06-11 7:37 ` Li Zefan
2009-06-11 7:37 ` Pekka Enberg
2009-06-11 7:50 ` Li Zefan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox