1
0

[PATCH] i386: Implement "current" with the PDA

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@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Chuck Ebbert <76306.1226@compuserve.com>
Cc: Zachary Amsden <zach@vmware.com>
Cc: Jan Beulich <jbeulich@novell.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
This commit is contained in:
Jeremy Fitzhardinge
2006-12-07 02:14:03 +01:00
committed by Andi Kleen
parent b2938f8808
commit ec7fcaabbf
5 changed files with 11 additions and 3 deletions

View File

@@ -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()

View File

@@ -7,12 +7,14 @@
#define _I386_PDA_H
#include <linux/stddef.h>
#include <linux/types.h>
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[];