Merge branch 'writeback' of git://git.kernel.dk/linux-2.6-block
[linux-block.git] / arch / um / include / asm / mmu_context.h
CommitLineData
1da177e4 1/*
ba180fd4 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
1da177e4
LT
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_MMU_CONTEXT_H
7#define __UM_MMU_CONTEXT_H
8
9#include "linux/sched.h"
d67b569f 10#include "um_mmu.h"
1da177e4 11
3963333f
JD
12extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
13extern void arch_exit_mmap(struct mm_struct *mm);
14
1da177e4
LT
15#define get_mmu_context(task) do ; while(0)
16#define activate_context(tsk) do ; while(0)
17
18#define deactivate_mm(tsk,mm) do { } while (0)
19
c40504e8
BL
20extern void force_flush_all(void);
21
1da177e4
LT
22static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
23{
1e40cd38 24 /*
aab2545f
ON
25 * This is called by fs/exec.c and sys_unshare()
26 * when the new ->mm is used for the first time.
1e40cd38 27 */
aab2545f 28 __switch_mm(&new->context.id);
3963333f 29 arch_dup_mmap(old, new);
1da177e4
LT
30}
31
1da177e4
LT
32static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
33 struct task_struct *tsk)
34{
35 unsigned cpu = smp_processor_id();
36
37 if(prev != next){
fa40699b
RR
38 cpumask_clear_cpu(cpu, mm_cpumask(prev));
39 cpumask_set_cpu(cpu, mm_cpumask(next));
1da177e4 40 if(next != &init_mm)
6c738ffa 41 __switch_mm(&next->context.id);
1da177e4
LT
42 }
43}
44
45static inline void enter_lazy_tlb(struct mm_struct *mm,
46 struct task_struct *tsk)
47{
48}
49
77bf4400 50extern int init_new_context(struct task_struct *task, struct mm_struct *mm);
1da177e4 51
77bf4400 52extern void destroy_context(struct mm_struct *mm);
1da177e4
LT
53
54#endif