mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dong Feng" <middle.fengdong@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-kernel@vger.kernel.org
Subject: Unnecessary Relocation Hiding?
Date: Wed, 23 Aug 2006 20:25:03 +0800	[thread overview]
Message-ID: <a2ebde260608230525w76a3ea6kef7a09e13f0018ea@mail.gmail.com> (raw)
In-Reply-To: <a2ebde260608230500o3407b108hc03debb9da6e62c@mail.gmail.com>

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

  reply	other threads:[~2006-08-23 12:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-23 12:00 Dong Feng
2006-08-23 12:25 ` Dong Feng [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2ebde260608230525w76a3ea6kef7a09e13f0018ea@mail.gmail.com \
    --to=middle.fengdong@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®