[lkml]   [2006]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectUnnecessary Relocation Hiding?
    Hi, all,

    I have a question. Why shall we need a RELOC_HIDE() macro in the
    definition of per_cpu()? Maybe the question is actually why we need
    macro RELOC_HIDE() at all. I changed the following line in
    include/asm-generic/percpu.h, from

    #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))


    #define per_cpu(var, cpu) (*((unsigned long)(&per_cpu__##var) +

    I recompiled the code and it works well on my Intel Dual-core laptop.
    It essentially the same as to change the definition of RELOC_HIDE(),

    #define RELOC_HIDE(ptr, off) \
    ({ unsigned long __ptr; \
    __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
    (typeof(ptr)) (__ptr + (off)); })


    #define RELOC_HIDE(ptr, off) \
    ({ unsigned long __ptr; \
    __ptr = (unsigned long)ptr; \
    (typeof(ptr)) (__ptr + (off)); })

    Why shouldn't we have a pure C solution in this part?

    Best Regards.
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-08-23 14:03    [W:0.034 / U:6.628 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site