trying to avoid "#ifdef CONFIG_NUMA"?
from <linux/kernel.h>:
/* This helps us to avoid #ifdef CONFIG_NUMA */
#ifdef CONFIG_NUMA
#define NUMA_BUILD 1
#else
#define NUMA_BUILD 0
#endif
however, there's still a pile of that preprocessor directive
scattered throughout the kernel. what kind of "avoidance" are we talking about here?
$ grep -r "#ifdef CONFIG_NUMA" * | wc -l 159
$ grep -rw NUMA_BUILD *
include/linux/kernel.h:#define NUMA_BUILD 1
include/linux/kernel.h:#define NUMA_BUILD 0
mm/page_alloc.c: if (NUMA_BUILD && zlc_active &&
mm/page_alloc.c: if (NUMA_BUILD)
mm/page_alloc.c: if (NUMA_BUILD && !did_zlc_setup) {
mm/page_alloc.c: if (unlikely(NUMA_BUILD && page = NULL && zlc_active)) {
mm/page_alloc.c: if (NUMA_BUILD && (gfp_mask & GFP_THISNODE) = GFP_THISNODE)
mm/page_alloc.c: if (NUMA_BUILD)
$not a lot of avoiding going on there, i'd say.
rday
--
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
====================================
Quoted 10 lines · Robert P. J. Day
/* This helps us to avoid #ifdef
CONFIG_NUMA*/
#ifdefCONFIG_NUMA
#defineNUMA_BUILD1
#else
#defineNUMA_BUILD0
#endif
mm/page_alloc.c: if (NUMA_BUILD&&zlc_active&¬ a lot of avoiding going on there, i'd say.
but it's important where it happens. it would uglify the code significantly to replace the if (NUMA_BUILD) with #ifdef CONFIG_NUMA. Maybe NUMA_BUILD should be used in more places, but how about doing something useful instead?
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 8 lines · Matthew Wilcox
Quoted 6 lines · Robert P. J. Day
/* This helps us to avoid #ifdef
CONFIG_NUMA*/
#ifdefCONFIG_NUMA
#defineNUMA_BUILD1
#else
#defineNUMA_BUILD0
#endif
Quoted 8 lines
Quoted 3 lines
mm/page_alloc.c: if (NUMA_BUILD&&zlc_active&¬ a lot of avoiding going on there, i'd say.
but it's important where it happens. it would uglify the code significantly to replace the if (
NUMA_BUILD) with #ifdefCONFIG_NUMA. MaybeNUMA_BUILDshould be used in more places, but how about doing something useful instead?
i wasn't planning on changing any of that, i was just trying to figure out why the comment promoted "avoiding" the #ifdef when there was so much of it still around.
rday
--
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
====================================
Quoted 14 lines · Robert P. J. Day
Quoted 12 lines · Matthew Wilcox
Quoted 10 lines · Robert P. J. Day
/* This helps us to avoid #ifdef
CONFIG_NUMA*/
#ifdefCONFIG_NUMA
#defineNUMA_BUILD1
#else
#defineNUMA_BUILD0
#endif
mm/page_alloc.c: if (NUMA_BUILD&&zlc_active&¬ a lot of avoiding going on there, i'd say.
Quoted 8 lines
Quoted 4 lines
but it's important where it happens. it would uglify the code significantly to replace the if (
NUMA_BUILD) with #ifdefCONFIG_NUMA. MaybeNUMA_BUILDshould be used in more places, but how about doing something useful instead?i wasn't planning on changing any of that, i was just trying to figure out why the comment promoted "avoiding" the #ifdef when there was so much of it still around.
It avoids it in the sense that you can now use NUMA_BUILD in expression, as opposed to CONFIG_NUMA, which won't take the value 0 if it's =n. It is not intended to replace CONFIG_NUMA when it is not used inside expressions. (That's my understanding of it anyway).
Vegard