aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2007-05-02 13:27:14 -0400
committerAndi Kleen <andi@basil.nowhere.org>2007-05-02 13:27:14 -0400
commitd6dd61c831226f9cd7750885da04d360d6455101 (patch)
tree30f84a429821d207f7de5dd6225d3d9515042c0a
parent5311ab62cdc7788784971ed816ce85e926f3e994 (diff)
[PATCH] x86: PARAVIRT: add hooks to intercept mm creation and destruction
Add hooks to allow a paravirt implementation to track the lifetime of an mm. Paravirtualization requires three hooks, but only two are needed in common code. They are: arch_dup_mmap, which is called when a new mmap is created at fork arch_exit_mmap, which is called when the last process reference to an mm is dropped, which typically happens on exit and exec. The third hook is activate_mm, which is called from the arch-specific activate_mm() macro/function, and so doesn't need stub versions for other architectures. It's called when an mm is first used. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Andi Kleen <ak@suse.de> Cc: linux-arch@vger.kernel.org Cc: James Bottomley <James.Bottomley@SteelEye.com> Acked-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/i386/kernel/paravirt.c4
-rw-r--r--include/asm-alpha/mmu_context.h1
-rw-r--r--include/asm-arm/mmu_context.h1
-rw-r--r--include/asm-arm26/mmu_context.h2
-rw-r--r--include/asm-avr32/mmu_context.h1
-rw-r--r--include/asm-cris/mmu_context.h2
-rw-r--r--include/asm-frv/mmu_context.h1
-rw-r--r--include/asm-generic/mm_hooks.h18
-rw-r--r--include/asm-h8300/mmu_context.h1
-rw-r--r--include/asm-i386/mmu_context.h17
-rw-r--r--include/asm-i386/paravirt.h23
-rw-r--r--include/asm-ia64/mmu_context.h1
-rw-r--r--include/asm-m32r/mmu_context.h1
-rw-r--r--include/asm-m68k/mmu_context.h1
-rw-r--r--include/asm-m68knommu/mmu_context.h1
-rw-r--r--include/asm-mips/mmu_context.h1
-rw-r--r--include/asm-parisc/mmu_context.h1
-rw-r--r--include/asm-powerpc/mmu_context.h1
-rw-r--r--include/asm-ppc/mmu_context.h1
-rw-r--r--include/asm-s390/mmu_context.h2
-rw-r--r--include/asm-sh/mmu_context.h1
-rw-r--r--include/asm-sh64/mmu_context.h2
-rw-r--r--include/asm-sparc/mmu_context.h2
-rw-r--r--include/asm-sparc64/mmu_context.h1
-rw-r--r--include/asm-um/mmu_context.h2
-rw-r--r--include/asm-v850/mmu_context.h2
-rw-r--r--include/asm-x86_64/mmu_context.h1
-rw-r--r--include/asm-xtensa/mmu_context.h1
-rw-r--r--kernel/fork.c2
-rw-r--r--mm/mmap.c4
30 files changed, 96 insertions, 3 deletions
diff --git a/arch/i386/kernel/paravirt.c b/arch/i386/kernel/paravirt.c
index 2040a831d5b3..54cc14d99740 100644
--- a/arch/i386/kernel/paravirt.c
+++ b/arch/i386/kernel/paravirt.c
@@ -237,6 +237,10 @@ struct paravirt_ops paravirt_ops = {
237 .irq_enable_sysexit = native_irq_enable_sysexit, 237 .irq_enable_sysexit = native_irq_enable_sysexit,
238 .iret = native_iret, 238 .iret = native_iret,
239 239
240 .dup_mmap = paravirt_nop,
241 .exit_mmap = paravirt_nop,
242 .activate_mm = paravirt_nop,
243
240 .startup_ipi_hook = paravirt_nop, 244 .startup_ipi_hook = paravirt_nop,
241}; 245};
242 246
diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h
index fe249e9d3360..0bd7bd2ccb90 100644
--- a/include/asm-alpha/mmu_context.h
+++ b/include/asm-alpha/mmu_context.h
@@ -10,6 +10,7 @@
10#include <asm/system.h> 10#include <asm/system.h>
11#include <asm/machvec.h> 11#include <asm/machvec.h>
12#include <asm/compiler.h> 12#include <asm/compiler.h>
13#include <asm-generic/mm_hooks.h>
13 14
14/* 15/*
15 * Force a context reload. This is needed when we change the page 16 * Force a context reload. This is needed when we change the page
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h
index d1a65b1edcaa..f8755c818b54 100644
--- a/include/asm-arm/mmu_context.h
+++ b/include/asm-arm/mmu_context.h
@@ -16,6 +16,7 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18#include <asm/proc-fns.h> 18#include <asm/proc-fns.h>
19#include <asm-generic/mm_hooks.h>
19 20
20void __check_kvm_seq(struct mm_struct *mm); 21void __check_kvm_seq(struct mm_struct *mm);
21 22
diff --git a/include/asm-arm26/mmu_context.h b/include/asm-arm26/mmu_context.h
index 1a929bfe5c3a..16c821f81b8d 100644
--- a/include/asm-arm26/mmu_context.h
+++ b/include/asm-arm26/mmu_context.h
@@ -13,6 +13,8 @@
13#ifndef __ASM_ARM_MMU_CONTEXT_H 13#ifndef __ASM_ARM_MMU_CONTEXT_H
14#define __ASM_ARM_MMU_CONTEXT_H 14#define __ASM_ARM_MMU_CONTEXT_H
15 15
16#include <asm-generic/mm_hooks.h>
17
16#define init_new_context(tsk,mm) 0 18#define init_new_context(tsk,mm) 0
17#define destroy_context(mm) do { } while(0) 19#define destroy_context(mm) do { } while(0)
18 20
diff --git a/include/asm-avr32/mmu_context.h b/include/asm-avr32/mmu_context.h
index 31add1ae8089..c37c391faef6 100644
--- a/include/asm-avr32/mmu_context.h
+++ b/include/asm-avr32/mmu_context.h
@@ -15,6 +15,7 @@
15#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
16#include <asm/pgalloc.h> 16#include <asm/pgalloc.h>
17#include <asm/sysreg.h> 17#include <asm/sysreg.h>
18#include <asm-generic/mm_hooks.h>
18 19
19/* 20/*
20 * The MMU "context" consists of two things: 21 * The MMU "context" consists of two things:
diff --git a/include/asm-cris/mmu_context.h b/include/asm-cris/mmu_context.h
index e6e659dc757b..72ba08dcfd18 100644
--- a/include/asm-cris/mmu_context.h
+++ b/include/asm-cris/mmu_context.h
@@ -1,6 +1,8 @@
1#ifndef __CRIS_MMU_CONTEXT_H 1#ifndef __CRIS_MMU_CONTEXT_H
2#define __CRIS_MMU_CONTEXT_H 2#define __CRIS_MMU_CONTEXT_H
3 3
4#include <asm-generic/mm_hooks.h>
5
4extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); 6extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
5extern void get_mmu_context(struct mm_struct *mm); 7extern void get_mmu_context(struct mm_struct *mm);
6extern void destroy_context(struct mm_struct *mm); 8extern void destroy_context(struct mm_struct *mm);
diff --git a/include/asm-frv/mmu_context.h b/include/asm-frv/mmu_context.h
index 72edcaaccd5d..c7daa395156a 100644
--- a/include/asm-frv/mmu_context.h
+++ b/include/asm-frv/mmu_context.h
@@ -15,6 +15,7 @@
15#include <asm/setup.h> 15#include <asm/setup.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
18#include <asm-generic/mm_hooks.h>
18 19
19static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 20static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
20{ 21{
diff --git a/include/asm-generic/mm_hooks.h b/include/asm-generic/mm_hooks.h
new file mode 100644
index 000000000000..67dea8123683
--- /dev/null
+++ b/include/asm-generic/mm_hooks.h
@@ -0,0 +1,18 @@
1/*
2 * Define generic no-op hooks for arch_dup_mmap and arch_exit_mmap, to
3 * be included in asm-FOO/mmu_context.h for any arch FOO which doesn't
4 * need to hook these.
5 */
6#ifndef _ASM_GENERIC_MM_HOOKS_H
7#define _ASM_GENERIC_MM_HOOKS_H
8
9static inline void arch_dup_mmap(struct mm_struct *oldmm,
10 struct mm_struct *mm)
11{
12}
13
14static inline void arch_exit_mmap(struct mm_struct *mm)
15{
16}
17
18#endif /* _ASM_GENERIC_MM_HOOKS_H */
diff --git a/include/asm-h8300/mmu_context.h b/include/asm-h8300/mmu_context.h
index 5c165f7bee0e..f44b730da54d 100644
--- a/include/asm-h8300/mmu_context.h
+++ b/include/asm-h8300/mmu_context.h
@@ -4,6 +4,7 @@
4#include <asm/setup.h> 4#include <asm/setup.h>
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
7#include <asm-generic/mm_hooks.h>
7 8
8static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 9static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
9{ 10{
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index e6aa30f8de5b..8198d1cca1f3 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -5,6 +5,16 @@
5#include <asm/atomic.h> 5#include <asm/atomic.h>
6#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
7#include <asm/tlbflush.h> 7#include <asm/tlbflush.h>
8#include <asm/paravirt.h>
9#ifndef CONFIG_PARAVIRT
10#include <asm-generic/mm_hooks.h>
11
12static inline void paravirt_activate_mm(struct mm_struct *prev,
13 struct mm_struct *next)
14{
15}
16#endif /* !CONFIG_PARAVIRT */
17
8 18
9/* 19/*
10 * Used for LDT copy/destruction. 20 * Used for LDT copy/destruction.
@@ -65,7 +75,10 @@ static inline void switch_mm(struct mm_struct *prev,
65#define deactivate_mm(tsk, mm) \ 75#define deactivate_mm(tsk, mm) \
66 asm("movl %0,%%gs": :"r" (0)); 76 asm("movl %0,%%gs": :"r" (0));
67 77
68#define activate_mm(prev, next) \ 78#define activate_mm(prev, next) \
69 switch_mm((prev),(next),NULL) 79 do { \
80 paravirt_activate_mm(prev, next); \
81 switch_mm((prev),(next),NULL); \
82 } while(0);
70 83
71#endif 84#endif
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index f93599dc7756..61c03f1e0c29 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -119,6 +119,12 @@ struct paravirt_ops
119 119
120 void (*io_delay)(void); 120 void (*io_delay)(void);
121 121
122 void (*activate_mm)(struct mm_struct *prev,
123 struct mm_struct *next);
124 void (*dup_mmap)(struct mm_struct *oldmm,
125 struct mm_struct *mm);
126 void (*exit_mmap)(struct mm_struct *mm);
127
122#ifdef CONFIG_X86_LOCAL_APIC 128#ifdef CONFIG_X86_LOCAL_APIC
123 void (*apic_write)(unsigned long reg, unsigned long v); 129 void (*apic_write)(unsigned long reg, unsigned long v);
124 void (*apic_write_atomic)(unsigned long reg, unsigned long v); 130 void (*apic_write_atomic)(unsigned long reg, unsigned long v);
@@ -395,6 +401,23 @@ static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
395} 401}
396#endif 402#endif
397 403
404static inline void paravirt_activate_mm(struct mm_struct *prev,
405 struct mm_struct *next)
406{
407 paravirt_ops.activate_mm(prev, next);
408}
409
410static inline void arch_dup_mmap(struct mm_struct *oldmm,
411 struct mm_struct *mm)
412{
413 paravirt_ops.dup_mmap(oldmm, mm);
414}
415
416static inline void arch_exit_mmap(struct mm_struct *mm)
417{
418 paravirt_ops.exit_mmap(mm);
419}
420
398#define __flush_tlb() paravirt_ops.flush_tlb_user() 421#define __flush_tlb() paravirt_ops.flush_tlb_user()
399#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel() 422#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel()
400#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr) 423#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr)
diff --git a/include/asm-ia64/mmu_context.h b/include/asm-ia64/mmu_context.h
index b5c65081a3aa..cef2400983fa 100644
--- a/include/asm-ia64/mmu_context.h
+++ b/include/asm-ia64/mmu_context.h
@@ -29,6 +29,7 @@
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30 30
31#include <asm/processor.h> 31#include <asm/processor.h>
32#include <asm-generic/mm_hooks.h>
32 33
33struct ia64_ctx { 34struct ia64_ctx {
34 spinlock_t lock; 35 spinlock_t lock;
diff --git a/include/asm-m32r/mmu_context.h b/include/asm-m32r/mmu_context.h
index 1f40d4a0acf1..91909e5dd9d0 100644
--- a/include/asm-m32r/mmu_context.h
+++ b/include/asm-m32r/mmu_context.h
@@ -15,6 +15,7 @@
15#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
16#include <asm/mmu.h> 16#include <asm/mmu.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18#include <asm-generic/mm_hooks.h>
18 19
19/* 20/*
20 * Cache of MMU context last used. 21 * Cache of MMU context last used.
diff --git a/include/asm-m68k/mmu_context.h b/include/asm-m68k/mmu_context.h
index 231d11bd8e32..894dacbcee14 100644
--- a/include/asm-m68k/mmu_context.h
+++ b/include/asm-m68k/mmu_context.h
@@ -1,6 +1,7 @@
1#ifndef __M68K_MMU_CONTEXT_H 1#ifndef __M68K_MMU_CONTEXT_H
2#define __M68K_MMU_CONTEXT_H 2#define __M68K_MMU_CONTEXT_H
3 3
4#include <asm-generic/mm_hooks.h>
4 5
5static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 6static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
6{ 7{
diff --git a/include/asm-m68knommu/mmu_context.h b/include/asm-m68knommu/mmu_context.h
index 6c077d3a2572..9ccee4278c97 100644
--- a/include/asm-m68knommu/mmu_context.h
+++ b/include/asm-m68knommu/mmu_context.h
@@ -4,6 +4,7 @@
4#include <asm/setup.h> 4#include <asm/setup.h>
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
7#include <asm-generic/mm_hooks.h>
7 8
8static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 9static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
9{ 10{
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index fe065d6070ca..65024ffd7879 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -20,6 +20,7 @@
20#include <asm/mipsmtregs.h> 20#include <asm/mipsmtregs.h>
21#include <asm/smtc.h> 21#include <asm/smtc.h>
22#endif /* SMTC */ 22#endif /* SMTC */
23#include <asm-generic/mm_hooks.h>
23 24
24/* 25/*
25 * For the fast tlb miss handlers, we keep a per cpu array of pointers 26 * For the fast tlb miss handlers, we keep a per cpu array of pointers
diff --git a/include/asm-parisc/mmu_context.h b/include/asm-parisc/mmu_context.h
index 9c05836239a2..bad690298f0c 100644
--- a/include/asm-parisc/mmu_context.h
+++ b/include/asm-parisc/mmu_context.h
@@ -5,6 +5,7 @@
5#include <asm/atomic.h> 5#include <asm/atomic.h>
6#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
7#include <asm/pgtable.h> 7#include <asm/pgtable.h>
8#include <asm-generic/mm_hooks.h>
8 9
9static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 10static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
10{ 11{
diff --git a/include/asm-powerpc/mmu_context.h b/include/asm-powerpc/mmu_context.h
index 083ac917bd29..c0d7795e3d25 100644
--- a/include/asm-powerpc/mmu_context.h
+++ b/include/asm-powerpc/mmu_context.h
@@ -10,6 +10,7 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <asm/mmu.h> 11#include <asm/mmu.h>
12#include <asm/cputable.h> 12#include <asm/cputable.h>
13#include <asm-generic/mm_hooks.h>
13 14
14/* 15/*
15 * Copyright (C) 2001 PPC 64 Team, IBM Corp 16 * Copyright (C) 2001 PPC 64 Team, IBM Corp
diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h
index 2bc8589cc451..a6441a063e5d 100644
--- a/include/asm-ppc/mmu_context.h
+++ b/include/asm-ppc/mmu_context.h
@@ -6,6 +6,7 @@
6#include <asm/bitops.h> 6#include <asm/bitops.h>
7#include <asm/mmu.h> 7#include <asm/mmu.h>
8#include <asm/cputable.h> 8#include <asm/cputable.h>
9#include <asm-generic/mm_hooks.h>
9 10
10/* 11/*
11 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs 12 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs
diff --git a/include/asm-s390/mmu_context.h b/include/asm-s390/mmu_context.h
index 1d21da220d49..501cb9b06314 100644
--- a/include/asm-s390/mmu_context.h
+++ b/include/asm-s390/mmu_context.h
@@ -10,6 +10,8 @@
10#define __S390_MMU_CONTEXT_H 10#define __S390_MMU_CONTEXT_H
11 11
12#include <asm/pgalloc.h> 12#include <asm/pgalloc.h>
13#include <asm-generic/mm_hooks.h>
14
13/* 15/*
14 * get a new mmu context.. S390 don't know about contexts. 16 * get a new mmu context.. S390 don't know about contexts.
15 */ 17 */
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h
index 342024425b7d..01acaaae9751 100644
--- a/include/asm-sh/mmu_context.h
+++ b/include/asm-sh/mmu_context.h
@@ -12,6 +12,7 @@
12#include <asm/tlbflush.h> 12#include <asm/tlbflush.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14#include <asm/io.h> 14#include <asm/io.h>
15#include <asm-generic/mm_hooks.h>
15 16
16/* 17/*
17 * The MMU "context" consists of two things: 18 * The MMU "context" consists of two things:
diff --git a/include/asm-sh64/mmu_context.h b/include/asm-sh64/mmu_context.h
index 8c860dab2d0e..507bf72bb8e1 100644
--- a/include/asm-sh64/mmu_context.h
+++ b/include/asm-sh64/mmu_context.h
@@ -27,7 +27,7 @@
27extern unsigned long mmu_context_cache; 27extern unsigned long mmu_context_cache;
28 28
29#include <asm/page.h> 29#include <asm/page.h>
30 30#include <asm-generic/mm_hooks.h>
31 31
32/* Current mm's pgd */ 32/* Current mm's pgd */
33extern pgd_t *mmu_pdtp_cache; 33extern pgd_t *mmu_pdtp_cache;
diff --git a/include/asm-sparc/mmu_context.h b/include/asm-sparc/mmu_context.h
index ed1e01d04d21..671a997b9e69 100644
--- a/include/asm-sparc/mmu_context.h
+++ b/include/asm-sparc/mmu_context.h
@@ -5,6 +5,8 @@
5 5
6#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
7 7
8#include <asm-generic/mm_hooks.h>
9
8static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 10static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
9{ 11{
10} 12}
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index 2337eb487719..8d129032013e 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -9,6 +9,7 @@
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <asm/system.h> 10#include <asm/system.h>
11#include <asm/spitfire.h> 11#include <asm/spitfire.h>
12#include <asm-generic/mm_hooks.h>
12 13
13static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 14static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
14{ 15{
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h
index f709c784bf12..9aa4b44e8cc1 100644
--- a/include/asm-um/mmu_context.h
+++ b/include/asm-um/mmu_context.h
@@ -6,6 +6,8 @@
6#ifndef __UM_MMU_CONTEXT_H 6#ifndef __UM_MMU_CONTEXT_H
7#define __UM_MMU_CONTEXT_H 7#define __UM_MMU_CONTEXT_H
8 8
9#include <asm-generic/mm_hooks.h>
10
9#include "linux/sched.h" 11#include "linux/sched.h"
10#include "choose-mode.h" 12#include "choose-mode.h"
11#include "um_mmu.h" 13#include "um_mmu.h"
diff --git a/include/asm-v850/mmu_context.h b/include/asm-v850/mmu_context.h
index f521c8050d3c..01daacd5474e 100644
--- a/include/asm-v850/mmu_context.h
+++ b/include/asm-v850/mmu_context.h
@@ -1,6 +1,8 @@
1#ifndef __V850_MMU_CONTEXT_H__ 1#ifndef __V850_MMU_CONTEXT_H__
2#define __V850_MMU_CONTEXT_H__ 2#define __V850_MMU_CONTEXT_H__
3 3
4#include <asm-generic/mm_hooks.h>
5
4#define destroy_context(mm) ((void)0) 6#define destroy_context(mm) ((void)0)
5#define init_new_context(tsk,mm) 0 7#define init_new_context(tsk,mm) 0
6#define switch_mm(prev,next,tsk) ((void)0) 8#define switch_mm(prev,next,tsk) ((void)0)
diff --git a/include/asm-x86_64/mmu_context.h b/include/asm-x86_64/mmu_context.h
index af03b9f852d6..0cce83a78378 100644
--- a/include/asm-x86_64/mmu_context.h
+++ b/include/asm-x86_64/mmu_context.h
@@ -7,6 +7,7 @@
7#include <asm/pda.h> 7#include <asm/pda.h>
8#include <asm/pgtable.h> 8#include <asm/pgtable.h>
9#include <asm/tlbflush.h> 9#include <asm/tlbflush.h>
10#include <asm-generic/mm_hooks.h>
10 11
11/* 12/*
12 * possibly do the LDT unload here? 13 * possibly do the LDT unload here?
diff --git a/include/asm-xtensa/mmu_context.h b/include/asm-xtensa/mmu_context.h
index f14851f086c3..92f948392ebc 100644
--- a/include/asm-xtensa/mmu_context.h
+++ b/include/asm-xtensa/mmu_context.h
@@ -18,6 +18,7 @@
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
20#include <asm/tlbflush.h> 20#include <asm/tlbflush.h>
21#include <asm-generic/mm_hooks.h>
21 22
22#define XCHAL_MMU_ASID_BITS 8 23#define XCHAL_MMU_ASID_BITS 8
23 24
diff --git a/kernel/fork.c b/kernel/fork.c
index 6af959c034d8..ffccefb28b6a 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -286,6 +286,8 @@ static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
286 if (retval) 286 if (retval)
287 goto out; 287 goto out;
288 } 288 }
289 /* a new mm has just been created */
290 arch_dup_mmap(oldmm, mm);
289 retval = 0; 291 retval = 0;
290out: 292out:
291 up_write(&mm->mmap_sem); 293 up_write(&mm->mmap_sem);
diff --git a/mm/mmap.c b/mm/mmap.c
index 84f997da78d7..88da687bde89 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -29,6 +29,7 @@
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <asm/cacheflush.h> 30#include <asm/cacheflush.h>
31#include <asm/tlb.h> 31#include <asm/tlb.h>
32#include <asm/mmu_context.h>
32 33
33#ifndef arch_mmap_check 34#ifndef arch_mmap_check
34#define arch_mmap_check(addr, len, flags) (0) 35#define arch_mmap_check(addr, len, flags) (0)
@@ -1979,6 +1980,9 @@ void exit_mmap(struct mm_struct *mm)
1979 unsigned long nr_accounted = 0; 1980 unsigned long nr_accounted = 0;
1980 unsigned long end; 1981 unsigned long end;
1981 1982
1983 /* mm's last user has gone, and its about to be pulled down */
1984 arch_exit_mmap(mm);
1985
1982 lru_add_drain(); 1986 lru_add_drain();
1983 flush_cache_mm(mm); 1987 flush_cache_mm(mm);
1984 tlb = tlb_gather_mmu(mm, 1); 1988 tlb = tlb_gather_mmu(mm, 1);