* [PATCH] replace for_each_cpu with for_each_cpu_mask
@ 2004-06-11 10:09 Bruno Ducrot
2004-06-11 12:27 ` Dave Jones
0 siblings, 1 reply; 5+ messages in thread
From: Bruno Ducrot @ 2004-06-11 10:09 UTC (permalink / raw)
To: Dave Jones; +Cc: cpufreq
On Thu, Jun 10, 2004 at 06:44:34PM +0200, Dominik Brodowski wrote:
> On Thu, Jun 10, 2004 at 05:37:11PM +0200, Bruno Ducrot wrote:
> > What about
> > for_each_cpu_mask(i, affected_cpu_map) {
> > ...
> > }
> > instead?
>
> That's indeed shorter -- don't know why whoever converted p4-clockmod
> to the
> new sibling mask did use for_each_cpu_mask...
Something like that should be ok, I guess.
arch/i386/kernel/cpu/cpufreq/p4-clockmod.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
--- linux-2.6.7-rc3-mm1/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c 2004/06/10 19:54:23 1.1
+++ linux-2.6.7-rc3-mm1/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c 2004/06/10 19:57:00
@@ -132,34 +132,28 @@ static int cpufreq_p4_target(struct cpuf
#endif
/* notifiers */
- for_each_cpu(i) {
- if (cpu_isset(i, affected_cpu_map)) {
- freqs.cpu = i;
- cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
- }
+ for_each_cpu_mask(i, affected_cpu_map) {
+ freqs.cpu = i;
+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
}
/* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software
* Developer's Manual, Volume 3
*/
- for_each_cpu(i) {
- if (cpu_isset(i, affected_cpu_map)) {
- cpumask_t this_cpu = cpumask_of_cpu(i);
+ for_each_cpu_mask(i, affected_cpu_map) {
+ cpumask_t this_cpu = cpumask_of_cpu(i);
- set_cpus_allowed(current, this_cpu);
- BUG_ON(smp_processor_id() != i);
+ set_cpus_allowed(current, this_cpu);
+ BUG_ON(smp_processor_id() != i);
- cpufreq_p4_setdc(i, p4clockmod_table[newstate].index);
- }
+ cpufreq_p4_setdc(i, p4clockmod_table[newstate].index);
}
set_cpus_allowed(current, cpus_allowed);
/* notifiers */
- for_each_cpu(i) {
- if (cpu_isset(i, affected_cpu_map)) {
- freqs.cpu = i;
- cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
- }
+ for_each_cpu_mask(i, affected_cpu_map) {
+ freqs.cpu = i;
+ cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
}
return 0;
--
Bruno Ducrot
-- Which is worse: ignorance or apathy?
-- Don't know. Don't care.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] replace for_each_cpu with for_each_cpu_mask
2004-06-11 10:09 [PATCH] replace for_each_cpu with for_each_cpu_mask Bruno Ducrot
@ 2004-06-11 12:27 ` Dave Jones
2004-06-11 13:18 ` Bruno Ducrot
0 siblings, 1 reply; 5+ messages in thread
From: Dave Jones @ 2004-06-11 12:27 UTC (permalink / raw)
To: Bruno Ducrot; +Cc: cpufreq
On Fri, Jun 11, 2004 at 12:09:12PM +0200, Bruno Ducrot wrote:
> > That's indeed shorter -- don't know why whoever converted p4-clockmod
> > to the new sibling mask did use for_each_cpu_mask...
I think I found out why.
> Something like that should be ok, I guess.
for_each_cpu_mask doesn't exist on non-SMP in mainline.
Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] replace for_each_cpu with for_each_cpu_mask
2004-06-11 12:27 ` Dave Jones
@ 2004-06-11 13:18 ` Bruno Ducrot
2004-06-11 13:29 ` Dave Jones
0 siblings, 1 reply; 5+ messages in thread
From: Bruno Ducrot @ 2004-06-11 13:18 UTC (permalink / raw)
To: Dave Jones; +Cc: cpufreq
On Fri, Jun 11, 2004 at 01:27:14PM +0100, Dave Jones wrote:
> On Fri, Jun 11, 2004 at 12:09:12PM +0200, Bruno Ducrot wrote:
>
> > > That's indeed shorter -- don't know why whoever converted p4-clockmod
> > > to the new sibling mask did use for_each_cpu_mask...
>
> I think I found out why.
>
> > Something like that should be ok, I guess.
>
> for_each_cpu_mask doesn't exist on non-SMP in mainline.
>
Well, you mean it's not in 2.6.7-rc3? I will take a look.
Thanks,
--
Bruno Ducrot
-- Which is worse: ignorance or apathy?
-- Don't know. Don't care.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] replace for_each_cpu with for_each_cpu_mask
2004-06-11 13:18 ` Bruno Ducrot
@ 2004-06-11 13:29 ` Dave Jones
2004-06-11 15:40 ` Bruno Ducrot
0 siblings, 1 reply; 5+ messages in thread
From: Dave Jones @ 2004-06-11 13:29 UTC (permalink / raw)
To: Bruno Ducrot; +Cc: cpufreq
On Fri, Jun 11, 2004 at 03:18:55PM +0200, Bruno Ducrot wrote:
> On Fri, Jun 11, 2004 at 01:27:14PM +0100, Dave Jones wrote:
> > On Fri, Jun 11, 2004 at 12:09:12PM +0200, Bruno Ducrot wrote:
> >
> > > > That's indeed shorter -- don't know why whoever converted p4-clockmod
> > > > to the new sibling mask did use for_each_cpu_mask...
> > I think I found out why.
> >
> > > Something like that should be ok, I guess.
> > for_each_cpu_mask doesn't exist on non-SMP in mainline.
> Well, you mean it's not in 2.6.7-rc3? I will take a look.
Yeah, ISTR there's a considerable reworking of the cpu mask stuff
in -mm, which is what you based on iirc.
Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] replace for_each_cpu with for_each_cpu_mask
2004-06-11 13:29 ` Dave Jones
@ 2004-06-11 15:40 ` Bruno Ducrot
0 siblings, 0 replies; 5+ messages in thread
From: Bruno Ducrot @ 2004-06-11 15:40 UTC (permalink / raw)
To: Dave Jones; +Cc: cpufreq
On Fri, Jun 11, 2004 at 02:29:19PM +0100, Dave Jones wrote:
> On Fri, Jun 11, 2004 at 03:18:55PM +0200, Bruno Ducrot wrote:
> > On Fri, Jun 11, 2004 at 01:27:14PM +0100, Dave Jones wrote:
> > > On Fri, Jun 11, 2004 at 12:09:12PM +0200, Bruno Ducrot wrote:
> > >
> > > > > That's indeed shorter -- don't know why whoever converted p4-clockmod
> > > > > to the new sibling mask did use for_each_cpu_mask...
> > > I think I found out why.
> > >
> > > > Something like that should be ok, I guess.
> > > for_each_cpu_mask doesn't exist on non-SMP in mainline.
> > Well, you mean it's not in 2.6.7-rc3? I will take a look.
>
> Yeah, ISTR there's a considerable reworking of the cpu mask stuff
> in -mm, which is what you based on iirc.
Ok. But I guess mainline is broken somehow then. for_each_cpu_mask
is the only macro not defined in include/linux/cpumask.h
Cheers,
--
Bruno Ducrot
-- Which is worse: ignorance or apathy?
-- Don't know. Don't care.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-06-11 15:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-11 10:09 [PATCH] replace for_each_cpu with for_each_cpu_mask Bruno Ducrot
2004-06-11 12:27 ` Dave Jones
2004-06-11 13:18 ` Bruno Ducrot
2004-06-11 13:29 ` Dave Jones
2004-06-11 15:40 ` Bruno Ducrot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.