RE: How to initialize complex per-cpu variables?

From: Perez-Gonzalez, Inaky (inaky.perez-gonzalez@intel.com)
Date: Thu Jun 05 2003 - 17:01:14 EST


> From: Perez-Gonzalez, Inaky [mailto:inaky.perez-gonzalez@intel.com]
> ...
> 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);
> }

Uh, I think it can be done perfectly as:

on_each_cpu (rtf_h_init, NULL, 1, 1);

with:

rtf_h_init (void *dummy) {
        const int cpu = get_cpu();
        struct rtf_h *h = per_cpu (rtf_lh, cpu);
        /* ... blah ... init the queues */
        put_cpu();
}

If I am wrong, pls let me know ...

TIA again

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/



This archive was generated by hypermail 2b29 : Sat Jun 07 2003 - 22:00:28 EST