thinkpad-acpi: be more strict when detecting a ThinkPad
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-x86 / mmu_context_32.h
blobd275232fa8abf7db3d09691b488ecc3621eb64ba
1 #ifndef __I386_SCHED_H
2 #define __I386_SCHED_H
4 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
6 #ifdef CONFIG_SMP
7 unsigned cpu = smp_processor_id();
8 if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
9 per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_LAZY;
10 #endif
13 static inline void switch_mm(struct mm_struct *prev,
14 struct mm_struct *next,
15 struct task_struct *tsk)
17 int cpu = smp_processor_id();
19 if (likely(prev != next)) {
20 #ifdef CONFIG_SMP
21 per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_OK;
22 per_cpu(cpu_tlbstate, cpu).active_mm = next;
23 #endif
24 cpu_set(cpu, next->cpu_vm_mask);
26 /* Re-load page tables */
27 load_cr3(next->pgd);
29 /* stop flush ipis for the previous mm */
30 cpu_clear(cpu, prev->cpu_vm_mask);
33 * load the LDT, if the LDT is different:
35 if (unlikely(prev->context.ldt != next->context.ldt))
36 load_LDT_nolock(&next->context);
38 #ifdef CONFIG_SMP
39 else {
40 per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_OK;
41 BUG_ON(per_cpu(cpu_tlbstate, cpu).active_mm != next);
43 if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) {
44 /* We were in lazy tlb mode and leave_mm disabled
45 * tlb flush IPI delivery. We must reload %cr3.
47 load_cr3(next->pgd);
48 load_LDT_nolock(&next->context);
51 #endif
54 #define deactivate_mm(tsk, mm) \
55 asm("movl %0,%%gs": :"r" (0));
57 #endif