Thread (11 messages) 11 messages, 5 authors, 2003-05-13

Re: 2.5.69-mm3

From: William Lee Irwin III <hidden>
Date: 2003-05-09 18:03:05
Also in: lkml

On Fri, May 09, 2003 at 11:12:57AM -0700, William Lee Irwin III wrote:
topology.h has a syntactic hygiene issue where it has a for () loop with
an if () in the body defined as a macro:
#define foo(...) for (...) if (...)
This patch prepares some of the bitop definitions used for the loop
mechanics to be usable in headers where BITS_PER_LONG is not guaranteed
to be defined for some reason. It removes the #ifdef on BITS_PER_LONG
in favor of if (sizeof(...) == ...) tests so hweight_long() will be
defined even when BITS_PER_LONG is not. unsigned long is also used for
some variables and/or return types that changed size with BITS_PER_LONG.
The 32-bit generic_hweight64() also changed its argument from a pointer
to a u64, which actually makes for a consistent interface in both cases.
The follow-up will make use of this to clean up the hygiene issue above
and correct a compilation error in topology.h

diff -urpN mm3-2.5.69-1/include/linux/topology.h mm3-2.5.69-2/include/linux/topology.h
--- mm3-2.5.69-1/include/linux/topology.h	2003-05-09 09:22:16.000000000 -0700
+++ mm3-2.5.69-2/include/linux/topology.h	2003-05-09 10:29:08.000000000 -0700
@@ -32,8 +32,15 @@
 
 #define nr_cpus_node(node)	(hweight_long(node_to_cpumask(node)))
 
+static inline int __next_node_with_cpus(int node)
+{
+	do
+		++node;
+	while (!nr_cpus_node(node) && node < numnodes);
+	return node;
+}
+
 #define for_each_node_with_cpus(node) \
-	for (node = 0; node < numnodes; node++) \
-		if (nr_cpus_node(node)
+	for (node = 0; node < numnodes; node = __next_node_with_cpus(node))
 
 #endif /* _LINUX_TOPOLOGY_H */
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help