(Note: Patch also attached because the inline version is certain to get line wrapped.) This introduces THREAD_ORDER (to accompany THREAD_SIZE, which now becomes a derivate of the former) in order to easily pass this to page allocation routines. Code consuming this (fixing the double fault handler to use per- CPU stacks) will soon follow. Signed-off-by: Jan Beulich <[email protected]> diff -Npru 2.6.13/arch/i386/kernel/asm-offsets.c 2.6.13-i386-THREAD_SIZE_asm/arch/i386/kernel/asm-offsets.c --- 2.6.13/arch/i386/kernel/asm-offsets.c 2005-08-29 01:41:01.000000000 +0200 +++ 2.6.13-i386-THREAD_SIZE_asm/arch/i386/kernel/asm-offsets.c 2005-09-02 16:19:30.000000000 +0200 @@ -68,5 +68,6 @@ void foo(void) sizeof(struct tss_struct)); DEFINE(PAGE_SIZE_asm, PAGE_SIZE); + DEFINE(THREAD_SIZE_asm, THREAD_SIZE); DEFINE(VSYSCALL_BASE, __fix_to_virt(FIX_VSYSCALL)); } diff -Npru 2.6.13/arch/i386/kernel/entry.S 2.6.13-i386-THREAD_SIZE_asm/arch/i386/kernel/entry.S --- 2.6.13/arch/i386/kernel/entry.S 2005-08-29 01:41:01.000000000 +0200 +++ 2.6.13-i386-THREAD_SIZE_asm/arch/i386/kernel/entry.S 2005-09-02 16:17:45.000000000 +0200 @@ -537,8 +537,8 @@ ENTRY(nmi) /* Do not access memory above the end of our stack page, * it might not exist. */ - andl $(THREAD_SIZE-1),%eax - cmpl $(THREAD_SIZE-20),%eax + andl $(THREAD_SIZE_asm-1),%eax + cmpl $(THREAD_SIZE_asm-20),%eax popl %eax jae nmi_stack_correct cmpl $sysenter_entry,12(%esp) diff -Npru 2.6.13/arch/i386/kernel/head.S 2.6.13-i386-THREAD_SIZE_asm/arch/i386/kernel/head.S --- 2.6.13/arch/i386/kernel/head.S 2005-08-29 01:41:01.000000000 +0200 +++ 2.6.13-i386-THREAD_SIZE_asm/arch/i386/kernel/head.S 2005-09-01 13:06:01.000000000 +0200 @@ -425,7 +425,7 @@ ENTRY(empty_zero_page) .data ENTRY(stack_start) - .long init_thread_union+THREAD_SIZE + .long init_thread_union+THREAD_SIZE_asm .long __BOOT_DS ready: .byte 0 diff -Npru 2.6.13/arch/i386/kernel/vmlinux.lds.S 2.6.13-i386-THREAD_SIZE_asm/arch/i386/kernel/vmlinux.lds.S --- 2.6.13/arch/i386/kernel/vmlinux.lds.S 2005-08-29 01:41:01.000000000 +0200 +++ 2.6.13-i386-THREAD_SIZE_asm/arch/i386/kernel/vmlinux.lds.S 2005-09-05 10:51:10.000000000 +0200 @@ -4,8 +4,9 @@ #define LOAD_OFFSET __PAGE_OFFSET +#include <linux/config.h> #include <asm-generic/vmlinux.lds.h> -#include <asm/thread_info.h> +#include <asm/asm_offsets.h> #include <asm/page.h> OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") @@ -62,7 +63,7 @@ SECTIONS .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) } _edata = .; /* End of data section */ - . = ALIGN(THREAD_SIZE); /* init_task */ + . = ALIGN(THREAD_SIZE_asm); /* init_task */ .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { *(.data.init_task) } diff -Npru 2.6.13/include/asm-i386/thread_info.h 2.6.13-i386-THREAD_SIZE_asm/include/asm-i386/thread_info.h --- 2.6.13/include/asm-i386/thread_info.h 2005-08-29 01:41:01.000000000 +0200 +++ 2.6.13-i386-THREAD_SIZE_asm/include/asm-i386/thread_info.h 2005-09-01 11:32:12.000000000 +0200 @@ -54,10 +54,11 @@ struct thread_info { #define PREEMPT_ACTIVE 0x10000000 #ifdef CONFIG_4KSTACKS -#define THREAD_SIZE (4096) +#define THREAD_ORDER 0 #else -#define THREAD_SIZE (8192) +#define THREAD_ORDER 1 #endif +#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) #define STACK_WARN (THREAD_SIZE/8) /* @@ -118,12 +119,12 @@ register unsigned long current_stack_poi /* how to get the thread information struct from ASM */ #define GET_THREAD_INFO(reg) \ - movl $-THREAD_SIZE, reg; \ + movl $-THREAD_SIZE_asm, reg; \ andl %esp, reg /* use this one if reg already contains %esp */ #define GET_THREAD_INFO_WITH_ESP(reg) \ - andl $-THREAD_SIZE, reg + andl $-THREAD_SIZE_asm, reg #endif
Attachment:
linux-2.6.13-i386-THREAD_ORDER.patch
Description: Binary data
- Prev by Date: Ethernet IP multicast maximum packet size
- Next by Date: [PATCH] fix i386 condition to call nmi_watchdog_tick
- Previous by thread: Ethernet IP multicast maximum packet size
- Next by thread: [PATCH] fix i386 condition to call nmi_watchdog_tick
- Index(es):