PER-CPU data

Dave Hylands dhylands at gmail.com
Fri Mar 30 02:35:58 EDT 2012


Hi Rajasekhar,

On Thu, Mar 29, 2012 at 11:00 PM, Rajasekhar Pulluru
<pullururajasekhar at gmail.com> wrote:
> Hi,
>
> I would like to know how per-cpu data are stored internally?
> And how are they protected from other cores?

I believe that they're just kmalloc'd like other kernel data. At the
kernel level there is no protection, just like all the rest of the
memory accessible to the kernel.
http://lxr.linux.no/#linux+v3.3/include/asm-generic/percpu.h#L8
http://lxr.linux.no/#linux+v3.3/mm/percpu.c

When you declare a per-cpu variable, it goes into a special section,
and what you're really doing is figuring out the offset within a
per_cpu region of memory.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com



More information about the Kernelnewbies mailing list