I appreciate the noble gesture of allowing NUMA people to
locate the per-cpu areas in different places in memory ;-)
That said, memcpy of static per-cpu areas doesn't seem right.
Why copy the same area to all the dynamically allocated per-cpu
areas ? Also, shouldn't the size be &__per_cpu_end - &__per_cpu_start ?
And how do we use this with per-cpu data used right
from smp boot, say apic_timer_irqs[] ?
Thanks
Dipankar
-- Dipankar Sarma <dipankar@in.ibm.com> http://lse.sourceforge.net Linux Technology Center, IBM Software Lab, Bangalore, India.
In article <E16GwUZ-0004xr-00@wagner.rustcorp.com.au> Rusty Russell wrote: > After some discussion, this may be a more sane (untested) per-cpu area > patch. It dynamically allocated the sections (and discards the > original), which would allow (future) NUMA people to make sure their > CPU area is allocated near them.
> Comments welcome, > Rusty. > -- > Anyone who quotes me in their sig is an idiot. -- Rusty Russell. > /* Called by boot processor to activate the rest. */ > static void __init smp_init(void) > { > + unsigned int i; > + size_t per_cpu_size; > + > /* Get other processors into their bootup holding patterns. */ > smp_boot_cpus(); > wait_init_idle = cpu_online_map; > @@ -324,6 +328,16 @@ > barrier(); > } > printk("All processors have done init_idle\n"); > + > + /* Set up per-CPU section pointers. Page align to be safe. */ > + per_cpu_size = ((&__per_cpu_end - &__per_cpu_start) + PAGE_SIZE-1) > + & ~(PAGE_SIZE-1); > + per_cpu_off[0] = kmalloc(per_cpu_size * smp_num_cpus, GFP_KERNEL); > + for (i = 0; i < smp_num_cpus; i++) { > + per_cpu_off[i] = per_cpu_off[0] + per_cpu_size; > + memcpy(per_cpu_off[i], &__per_cpu_start, > + __per_cpu_end - &__per_cpu_start); > + } > } > > #endif
- 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/