summaryrefslogtreecommitdiff
path: root/arch/x86/machine/pmap.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2014-09-03 21:22:26 +0200
committerRichard Braun <rbraun@sceen.net>2014-09-03 21:22:26 +0200
commiteed59b8076e7668b5e0f874bd3ed28230f470bb1 (patch)
treed5b7ddf4c01d3c8b9bbcd4fe957c0b40522ac15b /arch/x86/machine/pmap.c
parent7fa931d4e56e8926058c0a2a10d731614dfd6f65 (diff)
x86/cpu: improve percpu support
- declare CPU descriptors as percpu variables - make the percpu segment register point to the percpu area instead of the CPU descriptor - remove the ugly accessors for the local CPU descriptor, pmap and TCB and use percpu variables for them instead - implement the cpu_local accessors as described in the percpu documentation
Diffstat (limited to 'arch/x86/machine/pmap.c')
-rw-r--r--arch/x86/machine/pmap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/machine/pmap.c b/arch/x86/machine/pmap.c
index 680396f9..064f2440 100644
--- a/arch/x86/machine/pmap.c
+++ b/arch/x86/machine/pmap.c
@@ -145,6 +145,8 @@ static struct pmap kernel_pmap_store __read_mostly;
struct pmap *kernel_pmap __read_mostly = &kernel_pmap_store;
static struct pmap_cpu_table kernel_pmap_cpu_tables[MAX_CPUS] __read_mostly;
+struct pmap *pmap_current_ptr __percpu;
+
#ifdef X86_PAE
/*
* Alignment required on page directory pointer tables.
@@ -716,7 +718,7 @@ pmap_bootstrap(void)
mutex_init(&cpu_table->lock);
}
- cpu_percpu_set_pmap(kernel_pmap);
+ cpu_local_assign(pmap_current_ptr, kernel_pmap);
pmap_boot_heap = (unsigned long)&_end;
pmap_boot_heap_current = pmap_boot_heap;
@@ -777,7 +779,7 @@ pmap_bootstrap(void)
void __init
pmap_ap_bootstrap(void)
{
- cpu_percpu_set_pmap(kernel_pmap);
+ cpu_local_assign(pmap_current_ptr, kernel_pmap);
if (cpu_has_global_pages())
cpu_enable_global_pages();
@@ -1667,7 +1669,7 @@ pmap_load(struct pmap *pmap)
/* TODO Lazy TLB invalidation */
- cpu_percpu_set_pmap(pmap);
+ cpu_local_assign(pmap_current_ptr, pmap);
/* TODO Implement per-CPU page tables for non-kernel pmaps */
cpu_table = pmap->cpu_tables[cpu_id()];