I am having this issue I don't know how to solve (digged
the source, it didn't clarify)
I have this kind of half complex data structure that
needs to be per-cpu and I need to initialize them.
The problem is it contains an array of list_heads
and I cannot initialize that with an static initializer,
AFAIK:
#define NUMBER_OF_QUEUES 256
struct rtf_h {
spinlock_t lock;
struct list_head queues[NUMBER_OF_QUEUES];
}
static DEFINE_PER_CPU (struct rtf_h, rtf_lh);
So I want to initialize those - I cannot use the variable
initializing because (a) it is very dirty to add a huge
number of INIT_LIST_HEAD and (b) it would break the
DEFINE_PER_CPU() semantics, as I assume they are copied
and thus the values would be broken.
So I can have it initialized except the list_heads (only
the locks) and then manually initialize the list_heads
with some rth_h_init() function;
Now the question is: how do I walk each structure that is
associated to each CPU - I mean, something like:
struct rtf_h *h;
for_each_cpu (h, rtf_lh) {
rtf_h_init (h);
}
TIA
Iñaky Pérez-González -- Not speaking for Intel -- all opinions are my own
(and my fault)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/