linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] x86,percpu: fix DECLARE/DEFINE_PER_CPU_PAGE_ALIGNED()
Date: Mon, 03 Aug 2009 14:10:11 +0900	[thread overview]
Message-ID: <4A767133.1030207@kernel.org> (raw)
In-Reply-To: <alpine.LFD.2.01.0908021913130.3352@localhost.localdomain>

DECLARE/DEFINE_PER_CPU_PAGE_ALIGNED() put percpu variables in
.page_aligned section without adding any alignment restrictions.
Currently, this doesn't cause any problem because all users of the
macros have explicit page alignment and page-sized but it's much safer
to enforce page alignment from the macros.  After all, it's what they
claim to do.

Add __aligned(PAGE_SIZE) to DECLARE/DEFINE_PER_CPU_PAGE_ALIGNED() and
drop explicit alignment from it users.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
This doesn't cause any problem for the current tree.  No need to push
it hastily.

 arch/x86/kernel/cpu/common.c |    3 +--
 include/linux/percpu-defs.h  |    8 +++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index f1961c0..12493c5 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1008,8 +1008,7 @@ static const unsigned int exception_stack_sizes[N_EXCEPTION_STACKS] = {
 };

 static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks
-	[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ])
-	__aligned(PAGE_SIZE);
+	[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]);

 /* May not be marked __init: used by software suspend */
 void syscall_init(void)
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index aefc2f1..18d3147 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -117,11 +117,13 @@
 /*
  * Declaration/definition used for per-CPU variables that must be page aligned.
  */
-#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name)				\
-	DECLARE_PER_CPU_SECTION(type, name, ".page_aligned")
+#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name)			\
+	DECLARE_PER_CPU_SECTION(type, name, ".page_aligned")		\
+	__aligned(PAGE_SIZE)

 #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name)				\
-	DEFINE_PER_CPU_SECTION(type, name, ".page_aligned")
+	DEFINE_PER_CPU_SECTION(type, name, ".page_aligned")		\
+	__aligned(PAGE_SIZE)

 /*
  * Intermodule exports for per-CPU variables.
-- 
1.6.0.2


  parent reply	other threads:[~2009-08-03  5:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-31 18:13 [GIT PULL] Additional x86 fixes for 2.6.31-rc5 H. Peter Anvin
2009-07-31 19:45 ` Linus Torvalds
2009-07-31 19:57   ` Ingo Molnar
2009-08-01 19:28     ` Linus Torvalds
2009-08-01 19:38       ` H. Peter Anvin
2009-08-01 22:04         ` Linus Torvalds
2009-08-01 22:35           ` H. Peter Anvin
2009-08-02  1:20           ` Paul Mackerras
2009-08-02  3:52             ` H. Peter Anvin
2009-08-03  1:01               ` Tejun Heo
2009-08-03  1:14                 ` Linus Torvalds
2009-08-03  1:49       ` Tejun Heo
2009-08-03  2:14         ` Linus Torvalds
2009-08-03  5:08           ` [PATCH 1/3] x86: Add 'percpu_read_stable()' interface for cacheable accesses Tejun Heo
2009-08-03  5:13             ` H. Peter Anvin
2009-08-03  5:18               ` Tejun Heo
2009-08-03  6:04                 ` Ingo Molnar
2009-08-03  6:08                   ` H. Peter Anvin
2009-08-03  6:16                     ` Ingo Molnar
2009-08-03  7:00                       ` Ingo Molnar
2009-08-03 15:13                         ` [PATCH 1/3 UPDATED] x86, percpu: " Tejun Heo
2009-08-03  5:10           ` Tejun Heo [this message]
2009-08-03  5:12           ` [PATCH 3/3] x86: collect hot percpu variables into one cacheline Tejun Heo
2009-08-05  7:34     ` [GIT PULL] Additional x86 fixes for 2.6.31-rc5 Tan, Wei Chong
2009-08-05  8:06       ` Ingo Molnar
2009-08-10  0:42         ` Tan, Wei Chong
2009-08-10  9:05           ` Ingo Molnar
2009-08-10 15:32             ` Linus Torvalds
2009-08-10  9:06           ` [tip:x86/urgent] x86: Fix serialization in pit_expect_msb() tip-bot for Linus Torvalds
2009-08-10 18:01           ` tip-bot for Linus Torvalds
2009-08-05 23:10     ` [GIT PULL] Additional x86 fixes for 2.6.31-rc5 Tan, Wei Chong

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=4A767133.1030207@kernel.org \
    --to=tj@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).