mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][2.5] fix for_each_cpu compilation on UP
@ 2003-01-17  5:01 Zwane Mwaikambo
  2003-01-17  5:54 ` Andrew Morton
  2003-01-17 15:03 ` James Bottomley
  0 siblings, 2 replies; 4+ messages in thread
From: Zwane Mwaikambo @ 2003-01-17  5:01 UTC (permalink / raw)
  To: Linux Kernel; +Cc: James Bottomley, Andrew Morton

This adds a definition for for_each_cpu when !CONFIG_SMP

Please apply

Index: linux-2.5.58-cpu_hotplug/include/linux/smp.h
===================================================================
RCS file: /build/cvsroot/linux-2.5.58/include/linux/smp.h,v
retrieving revision 1.1.1.1.2.3
diff -u -r1.1.1.1.2.3 smp.h
--- linux-2.5.58-cpu_hotplug/include/linux/smp.h	17 Jan 2003 03:13:12 -0000	1.1.1.1.2.3
+++ linux-2.5.58-cpu_hotplug/include/linux/smp.h	17 Jan 2003 03:14:40 -0000
@@ -109,6 +109,7 @@
 #define num_booting_cpus()			1
 #define cpu_possible(cpu)			({ BUG_ON((cpu) != 0); 1; })
 #define smp_prepare_boot_cpu()			do {} while (0)
+#define for_each_cpu(cpu, mask)			for (cpu = 0; cpu == 0; cpu++)
 
 struct notifier_block;
 

-- 
function.linuxpower.ca


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][2.5] fix for_each_cpu compilation on UP
  2003-01-17  5:01 [PATCH][2.5] fix for_each_cpu compilation on UP Zwane Mwaikambo
@ 2003-01-17  5:54 ` Andrew Morton
  2003-01-17 15:03 ` James Bottomley
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2003-01-17  5:54 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: linux-kernel, James.Bottomley

Zwane Mwaikambo <zwane@holomorphy.com> wrote:
>
> This adds a definition for for_each_cpu when !CONFIG_SMP
> 
> Please apply
> 
> Index: linux-2.5.58-cpu_hotplug/include/linux/smp.h
> ===================================================================
> RCS file: /build/cvsroot/linux-2.5.58/include/linux/smp.h,v
> retrieving revision 1.1.1.1.2.3
> diff -u -r1.1.1.1.2.3 smp.h
> --- linux-2.5.58-cpu_hotplug/include/linux/smp.h	17 Jan 2003 03:13:12 -0000	1.1.1.1.2.3
> +++ linux-2.5.58-cpu_hotplug/include/linux/smp.h	17 Jan 2003 03:14:40 -0000
> @@ -109,6 +109,7 @@
>  #define num_booting_cpus()			1
>  #define cpu_possible(cpu)			({ BUG_ON((cpu) != 0); 1; })
>  #define smp_prepare_boot_cpu()			do {} while (0)
> +#define for_each_cpu(cpu, mask)			for (cpu = 0; cpu == 0; cpu++)
>  

This will cause nasty warnings (and posibly break) x86_64 builds, which
define their own for_each_cpu() in the !CONFIG_SMP case.

wimpy fix: move this into include/asm-i386/smp.h

nice fix: do a generic for_each_cpu() in include/linux/wherever.h, and rip
out the arch-private definitions.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][2.5] fix for_each_cpu compilation on UP
  2003-01-17  5:01 [PATCH][2.5] fix for_each_cpu compilation on UP Zwane Mwaikambo
  2003-01-17  5:54 ` Andrew Morton
@ 2003-01-17 15:03 ` James Bottomley
  2003-01-17 16:44   ` Zwane Mwaikambo
  1 sibling, 1 reply; 4+ messages in thread
From: James Bottomley @ 2003-01-17 15:03 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Linux Kernel, James Bottomley, Andrew Morton

zwane@holomorphy.com said:
> This adds a definition for for_each_cpu when !CONFIG_SMP
> Please apply 

Could you elaborate on the purpose of this a bit?  for_each_cpu() is only used 
by the voyager subarch on x86 to traverse sparse CPU bitmaps efficiently in 
critical path code.  It has no other use in x86 SMP because all other 
subarch's tend to compact the CPU bitmap much more.

If there are other uses for the construct, it should probably be put in bitops 
and become for_each_bit(i, mask)

James



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][2.5] fix for_each_cpu compilation on UP
  2003-01-17 15:03 ` James Bottomley
@ 2003-01-17 16:44   ` Zwane Mwaikambo
  0 siblings, 0 replies; 4+ messages in thread
From: Zwane Mwaikambo @ 2003-01-17 16:44 UTC (permalink / raw)
  To: James Bottomley; +Cc: Linux Kernel, Andrew Morton

On Fri, 17 Jan 2003, James Bottomley wrote:

> zwane@holomorphy.com said:
> > This adds a definition for for_each_cpu when !CONFIG_SMP
> > Please apply 
> 
> Could you elaborate on the purpose of this a bit?  for_each_cpu() is only used 
> by the voyager subarch on x86 to traverse sparse CPU bitmaps efficiently in 
> critical path code.  It has no other use in x86 SMP because all other 
> subarch's tend to compact the CPU bitmap much more.
> 
> If there are other uses for the construct, it should probably be put in bitops 
> and become for_each_bit(i, mask)

It's still useful in the general case for avoiding access of per cpu 
memory when a cpu is offline as well as avoiding triggering events on 
cpus which aren't online anymore. I'm going to hold back on this for a bit 
till i actually release the code which depends on this infrastructure.

	Zwane
-- 
function.linuxpower.ca


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-01-17 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-17  5:01 [PATCH][2.5] fix for_each_cpu compilation on UP Zwane Mwaikambo
2003-01-17  5:54 ` Andrew Morton
2003-01-17 15:03 ` James Bottomley
2003-01-17 16:44   ` Zwane Mwaikambo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®