Rusty Russell wrote: > This patch uses the "gs" segment register which Jeremy Fitzhardinge > freed up for kernel use, for the per-cpu section. This means that > instead of having a special per-cpu struct which we can access in a > single instruction, any per-cpu variable can be accessed in a single > instruction. In addition, it avoids introducing the concept of a > "pda" into the kernel, in favour of the well-known "percpu" concept. > The PDA is well established in the x86-64 tree; one of the reasons for having an x86-32 PDA was to make the trees a bit more similar. > More cleanups/optimizations are possible: > 1) Don't save/restore %gs on UP. The cost is measurable, and we don't use it. > You need to make sure the userspace %gs gets saved/restored for context switch. If you don't do it in entry.S, you need to have two versions of the %gs-handling code in a number of places around the kernel (__switch_to, vm86, ptrace). > 2) Remove early_smp_processor_id(), by setting up the per-cpu > processor_id field correctly before starting a CPU. > 3) Similarly, get rid of early_current(). > I've already submitted a patch to do this. In fact, it would help if you could rebase against my most recent patches (which I think Andrew has queued for the next -mm, and are in the paravirt patch queue). Also, does this patch address the problem of percpu module variables? That was the only real sticking point with my previous percpu-in-pda patch. I can't say this patch fills me with joy. J