+ i386-pda-implement-current-with-the-pda.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     i386-pda: Implement "current" with the PDA

has been added to the -mm tree.  Its filename is

     i386-pda-implement-current-with-the-pda.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: i386-pda: Implement "current" with the PDA
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>

Use the pcurrent field in the PDA to implement the "current" macro.  This ends
up compiling down to a single instruction to get the current task.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
Cc: Chuck Ebbert <76306.1226@xxxxxxxxxxxxxx>
Cc: Zachary Amsden <zach@xxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 arch/i386/kernel/asm-offsets.c |    2 ++
 arch/i386/kernel/cpu/common.c  |    2 ++
 arch/i386/kernel/process.c     |    1 +
 include/asm-i386/current.h     |    7 ++++---
 include/asm-i386/pda.h         |    1 +
 5 files changed, 10 insertions(+), 3 deletions(-)

diff -puN arch/i386/kernel/asm-offsets.c~i386-pda-implement-current-with-the-pda arch/i386/kernel/asm-offsets.c
--- a/arch/i386/kernel/asm-offsets.c~i386-pda-implement-current-with-the-pda
+++ a/arch/i386/kernel/asm-offsets.c
@@ -15,6 +15,7 @@
 #include <asm/processor.h>
 #include <asm/thread_info.h>
 #include <asm/elf.h>
+#include <asm/pda.h>
 
 #define DEFINE(sym, val) \
         asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -99,4 +100,5 @@ void foo(void)
 
 	BLANK();
  	OFFSET(PDA_cpu, i386_pda, cpu_number);
+	OFFSET(PDA_pcurrent, i386_pda, pcurrent);
 }
diff -puN arch/i386/kernel/cpu/common.c~i386-pda-implement-current-with-the-pda arch/i386/kernel/cpu/common.c
--- a/arch/i386/kernel/cpu/common.c~i386-pda-implement-current-with-the-pda
+++ a/arch/i386/kernel/cpu/common.c
@@ -651,6 +651,7 @@ __cpuinit int alloc_gdt(int cpu)
 struct i386_pda boot_pda = {
 	._pda = &boot_pda,
 	.cpu_number = 0,
+	.pcurrent = &init_task,
 };
 
 static inline void set_kernel_gs(void)
@@ -696,6 +697,7 @@ __cpuinit int init_gdt(int cpu, struct t
 	memset(pda, 0, sizeof(*pda));
 	pda->_pda = pda;
 	pda->cpu_number = cpu;
+	pda->pcurrent = idle;
 
 	return 1;
 }
diff -puN arch/i386/kernel/process.c~i386-pda-implement-current-with-the-pda arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c~i386-pda-implement-current-with-the-pda
+++ a/arch/i386/kernel/process.c
@@ -688,6 +688,7 @@ struct task_struct fastcall * __switch_t
 	if (unlikely(prev->fs | next->fs))
 		loadsegment(fs, next->fs);
 
+	write_pda(pcurrent, next_p);
 
 	/*
 	 * Restore IOPL if needed.
diff -puN include/asm-i386/current.h~i386-pda-implement-current-with-the-pda include/asm-i386/current.h
--- a/include/asm-i386/current.h~i386-pda-implement-current-with-the-pda
+++ a/include/asm-i386/current.h
@@ -1,13 +1,14 @@
 #ifndef _I386_CURRENT_H
 #define _I386_CURRENT_H
 
-#include <linux/thread_info.h>
+#include <asm/pda.h>
+#include <linux/compiler.h>
 
 struct task_struct;
 
-static __always_inline struct task_struct * get_current(void)
+static __always_inline struct task_struct *get_current(void)
 {
-	return current_thread_info()->task;
+	return read_pda(pcurrent);
 }
  
 #define current get_current()
diff -puN include/asm-i386/pda.h~i386-pda-implement-current-with-the-pda include/asm-i386/pda.h
--- a/include/asm-i386/pda.h~i386-pda-implement-current-with-the-pda
+++ a/include/asm-i386/pda.h
@@ -13,6 +13,7 @@ struct i386_pda
 	struct i386_pda *_pda;		/* pointer to self */
 
 	int cpu_number;
+	struct task_struct *pcurrent;	/* current process */
 };
 
 extern struct i386_pda *_cpu_pda[];
_

Patches currently in -mm which might be from jeremy@xxxxxxxx are

x86-remove-default_ldt-and-simplify-ldt-setting.patch
i386-use-asm-offsets-for-the-offsets-of-registers-into-the-pt_regs-struct-rather-than-having-hard-coded-constants.patch
i386-pda-basic-definitions-for-i386-pda.patch
i386-pda-initialize-the-per-cpu-data-area.patch
i386-pda-use-%gs-as-the-pda-base-segment-in-the-kernel.patch
i386-pda-fix-places-where-using-%gs-changes-the-usermode-abi.patch
i386-pda-update-sys_vm86-to-cope-with-changed-pt_regs-and-%gs-usage.patch
i386-pda-implement-smp_processor_id-with-the-pda.patch
i386-pda-implement-current-with-the-pda.patch
i386-pda-store-the-interrupt-regs-pointer-in-the-pda.patch
generic-bug-implementation.patch
generic-bug-for-i386.patch
generic-bug-for-x86-64.patch
generic-bug-for-powerpc.patch
uml-add-generic-bug-support.patch
use-generic-bug-for-ppc.patch
bug-test-1.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux