All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] another minor bit of cpumask cleanup
@ 2003-12-22  2:00 Paul Jackson
  2003-12-22  2:14 ` William Lee Irwin III
  2003-12-22  6:47 ` Andrew Morton
  0 siblings, 2 replies; 11+ messages in thread
From: Paul Jackson @ 2003-12-22  2:00 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel@vger.kernel.org; +Cc: Ingo Oeser

Ingo Oeser pointed out to me in private email that one of the cpumask
macros was broken - the macro for for_each_online_cpu() starts its loop
with _any_ cpu from the provided mask, and only worries about restricting
itself to _online_ cpus when looping to the next cpu:

include/linux/cpumask.h:
> #define for_each_online_cpu(cpu, map)                                   \
>         for (cpu = first_cpu_const(mk_cpumask_const(map));              \
>                 cpu < NR_CPUS;                                          \
>                 cpu = next_online_cpu(cpu,map))

Looking further, I see this macro is never used, and its subordinate
inline macro next_online_cpu() used no where else.  What's more, it's
redundant.  Calling it with a map of "cpu_online_map" (which you have to
do, given it's broken thus) is just as good as calling the macro right
above, "for_each_cpu()", with that same "cpu_online_map". Indeed the
only uses of "for_each_cpu()", in arch/i386/mach-voyager/voyager_smp.c,
do pass "cpu_online_map" explicitly, in 5 of 6 calls there from.

So, having found a piece of code that is broken, redundant and unused,
I hereby off the following patch to remove it.

Thank-you, Ingo.


# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1497  -> 1.1498 
#	include/linux/cpumask.h	1.2     -> 1.3    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/12/21	pj@sgi.com	1.1498
# Remove a couple unused, redundant, confused macros
# --------------------------------------------
#
diff -Nru a/include/linux/cpumask.h b/include/linux/cpumask.h
--- a/include/linux/cpumask.h	Sun Dec 21 17:37:14 2003
+++ b/include/linux/cpumask.h	Sun Dec 21 17:37:14 2003
@@ -17,22 +17,9 @@
 #define cpu_online(cpu)			({ BUG_ON((cpu) != 0); 1; })
 #endif
 
-static inline int next_online_cpu(int cpu, cpumask_t map)
-{
-	do
-		cpu = next_cpu_const(cpu, map);
-	while (cpu < NR_CPUS && !cpu_online(cpu));
-	return cpu;
-}
-
 #define for_each_cpu(cpu, map)						\
 	for (cpu = first_cpu_const(map);				\
 		cpu < NR_CPUS;						\
 		cpu = next_cpu_const(cpu,map))
-
-#define for_each_online_cpu(cpu, map)					\
-	for (cpu = first_cpu_const(map);				\
-		cpu < NR_CPUS;						\
-		cpu = next_online_cpu(cpu,map))
 
 #endif /* __LINUX_CPUMASK_H */


-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@sgi.com> 1.650.933.1373

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

end of thread, other threads:[~2003-12-24 10:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-22  2:00 [PATCH] another minor bit of cpumask cleanup Paul Jackson
2003-12-22  2:14 ` William Lee Irwin III
2003-12-22  6:47 ` Andrew Morton
2003-12-22  7:19   ` Paul Jackson
2003-12-22  8:57     ` William Lee Irwin III
2003-12-22 12:32       ` Paul Jackson
2003-12-23  1:45     ` Rusty Russell
2003-12-23 10:10       ` Paul Jackson
2003-12-24  1:26         ` Rusty Russell
2003-12-24  3:18           ` Paul Jackson
2003-12-24 10:55             ` William Lee Irwin III

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.