All of lore.kernel.org
 help / color / mirror / Atom feed
* Unnecessary Relocation Hiding?
@ 2006-08-23 12:00 Dong Feng
  2006-08-23 12:25 ` Dong Feng
  2006-08-24 18:26 ` Christoph Lameter
  0 siblings, 2 replies; 11+ messages in thread
From: Dong Feng @ 2006-08-23 12:00 UTC (permalink / raw)
  To: linux-kernel

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]))

to

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

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(),
from

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

to


#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.
Feng,Dong

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-08-25  7:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-23 12:00 Unnecessary Relocation Hiding? Dong Feng
2006-08-23 12:25 ` Dong Feng
2006-08-24 18:26 ` Christoph Lameter
2006-08-24 19:24   ` Andi Kleen
2006-08-24 23:31   ` Paul Mackerras
2006-08-25  1:30     ` Dong Feng
2006-08-25  3:49       ` Paul Mackerras
     [not found]         ` <a2ebde260608242329r12259e0k7e798ee1d8737d68@mail.gmail.com>
2006-08-25  6:39           ` Fwd: " Dong Feng
2006-08-25  6:18       ` Andi Kleen
2006-08-25  7:20         ` Paul Mackerras
2006-08-25  7:38           ` Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.