public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: travis@sgi.com, linux-kernel@vger.kernel.org
Subject: [patch 9/9] x86: thread_info: Merge thread_info allocation
Date: Mon, 28 Apr 2008 18:52:40 -0700	[thread overview]
Message-ID: <20080429015302.614225671@sgi.com> (raw)
In-Reply-To: 20080429015231.908196699@sgi.com

[-- Attachment #1: join_thread_alloc --]
[-- Type: text/plain, Size: 3267 bytes --]

Make them similar so that both use THREAD_ORDER and THREAD_FLAGS and have a
THREAD_SIZE definition that is setup in asm/page_xx.h

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
 include/asm-x86/page_32.h     |    8 ++++++++
 include/asm-x86/thread_info.h |   37 +++++++++++--------------------------
 2 files changed, 19 insertions(+), 26 deletions(-)

Index: linux-2.6/include/asm-x86/thread_info.h
===================================================================
--- linux-2.6.orig/include/asm-x86/thread_info.h	2008-04-28 17:57:48.509890170 -0700
+++ linux-2.6/include/asm-x86/thread_info.h	2008-04-28 18:05:32.639893442 -0700
@@ -132,6 +132,7 @@ struct thread_info {
 /* work to do on any return to user space */
 #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
 
+/* Only used for 64 bit */
 #define _TIF_DO_NOTIFY_MASK						\
 	(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY|_TIF_HRTICK_RESCHED)
 
@@ -143,18 +144,21 @@ struct thread_info {
 #define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW
 #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
 
-
 #define PREEMPT_ACTIVE		0x10000000
 
-#ifdef CONFIG_X86_32
-
-#ifdef CONFIG_4KSTACKS
-#define THREAD_SIZE            (4096)
+/* thread information allocation */
+#ifdef CONFIG_DEBUG_STACK_USAGE
+#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO)
 #else
-#define THREAD_SIZE		(8192)
+#define THREAD_FLAGS GFP_KERNEL
 #endif
 
-#define STACK_WARN             (THREAD_SIZE/8)
+#define alloc_thread_info(tsk)						\
+	((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER))
+
+#ifdef CONFIG_X86_32
+
+#define STACK_WARN	(THREAD_SIZE/8)
 /*
  * macros/functions for gaining access to the thread information structure
  *
@@ -173,15 +177,6 @@ static inline struct thread_info *curren
 		(current_stack_pointer & ~(THREAD_SIZE - 1));
 }
 
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info(tsk) ((struct thread_info *)			\
-	__get_free_pages(GFP_KERNEL | __GFP_ZERO, get_order(THREAD_SIZE)))
-#else
-#define alloc_thread_info(tsk) ((struct thread_info *)			\
-	__get_free_pages(GFP_KERNEL, get_order(THREAD_SIZE)))
-#endif
-
 #else /* !__ASSEMBLY__ */
 
 /* how to get the thread information struct from ASM */
@@ -219,16 +214,6 @@ static inline struct thread_info *stack_
 	return ti;
 }
 
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO)
-#else
-#define THREAD_FLAGS GFP_KERNEL
-#endif
-
-#define alloc_thread_info(tsk)						\
-	((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER))
-
 #else /* !__ASSEMBLY__ */
 
 /* how to get the thread information struct from ASM */
Index: linux-2.6/include/asm-x86/page_32.h
===================================================================
--- linux-2.6.orig/include/asm-x86/page_32.h	2008-04-24 22:36:10.593649417 -0700
+++ linux-2.6/include/asm-x86/page_32.h	2008-04-28 17:58:35.272390596 -0700
@@ -13,6 +13,14 @@
  */
 #define __PAGE_OFFSET		_AC(CONFIG_PAGE_OFFSET, UL)
 
+#ifdef CONFIG_4KSTACKS
+#define THREAD_ORDER	0
+#else
+#define THREAD_ORDER	1
+#endif
+#define THREAD_SIZE 	(PAGE_SIZE << THREAD_ORDER)
+
+
 #ifdef CONFIG_X86_PAE
 #define __PHYSICAL_MASK_SHIFT	36
 #define __VIRTUAL_MASK_SHIFT	32

-- 

  parent reply	other threads:[~2008-04-29  1:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-29  1:52 [patch 0/9] [RFC] x86: Merge thread_info_32/64 to thread_info.h Christoph Lameter
2008-04-29  1:52 ` [patch 1/9] x86: merge thread_info.h Christoph Lameter
2008-04-29  1:52 ` [patch 2/9] x86: threadinfo: Common include files Christoph Lameter
2008-04-29  1:52 ` [patch 3/9] x86: threadinfo: Merge thread sync state definitions Christoph Lameter
2008-04-29  1:52 ` [patch 4/9] x86: common thread_info definitions Christoph Lameter
2008-04-29  1:52 ` [patch 5/9] x86: threadinfo: Merge INIT_THREAD_INFO Christoph Lameter
2008-04-29  1:52 ` [patch 6/9] x86: thread_info: PREEMPT_ACTIVE Christoph Lameter
2008-04-29  1:52 ` [patch 7/9] x86: thread_info: Merget TIF_ flags Christoph Lameter
2008-04-29  1:52 ` [patch 8/9] x86: thread_info: merge tif masks Christoph Lameter
2008-04-29  1:52 ` Christoph Lameter [this message]
2008-04-29  9:40 ` [patch 0/9] [RFC] x86: Merge thread_info_32/64 to thread_info.h Ingo Molnar

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=20080429015302.614225671@sgi.com \
    --to=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=travis@sgi.com \
    /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