patch-2.2.19 linux/include/asm-alpha/mmu_context.h
Next file: linux/include/asm-alpha/page.h
Previous file: linux/fs/smbfs/proc.c
Back to the patch index
Back to the overall index
- Lines: 66
- Date:
Sun Mar 25 11:37:39 2001
- Orig file:
v2.2.18/include/asm-alpha/mmu_context.h
- Orig date:
Sun Mar 25 11:12:39 2001
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.18/include/asm-alpha/mmu_context.h linux/include/asm-alpha/mmu_context.h
@@ -65,12 +65,7 @@
#endif /* __SMP__ */
#define WIDTH_HARDWARE_ASN 8
-#ifdef __SMP__
-#define WIDTH_THIS_PROCESSOR 5
-#else
-#define WIDTH_THIS_PROCESSOR 0
-#endif
-#define ASN_FIRST_VERSION (1UL << (WIDTH_THIS_PROCESSOR + WIDTH_HARDWARE_ASN))
+#define ASN_FIRST_VERSION (1UL << WIDTH_HARDWARE_ASN)
#define HARDWARE_ASN_MASK ((1UL << WIDTH_HARDWARE_ASN) - 1)
/*
@@ -100,6 +95,7 @@
/* If we've wrapped, flush the whole user TLB. */
if ((asn & HARDWARE_ASN_MASK) >= MAX_ASN) {
tbiap();
+ imb();
next = (asn & ~HARDWARE_ASN_MASK) + ASN_FIRST_VERSION;
}
cpu_last_asn(smp_processor_id()) = next;
@@ -125,19 +121,21 @@
__EXTERN_INLINE void
ev5_get_mmu_context(struct task_struct *p)
{
- /* Check if our ASN is of an older version, or on a different CPU,
- and thus invalid. */
- /* ??? If we have two threads on different cpus, we'll continually
- fight over the context. Find a way to record a per-mm, per-cpu
- value for the asn. */
-
- unsigned long asn = cpu_last_asn(smp_processor_id());
- struct mm_struct *mm = p->mm;
- unsigned long mmc = mm->context;
+ /* Check if our ASN is of an older version, and thus invalid. */
+ int cpu;
+ unsigned long asn;
+ struct mm_struct *mm;
+ unsigned long mmc;
+ cpu = smp_processor_id();
+ mm = p->mm;
+ ctx_cli();
+ asn = cpu_last_asn(cpu);
+ mmc = mm->context[cpu];
+
if ((mmc ^ asn) & ~HARDWARE_ASN_MASK) {
mmc = __get_new_mmu_context();
- mm->context = mmc;
+ mm->context[cpu] = mmc;
}
/* Always update the PCB ASN. Another thread may have allocated
@@ -159,7 +157,10 @@
extern inline void
init_new_context(struct mm_struct *mm)
{
- mm->context = 0;
+ int i;
+
+ for (i = 0; i < smp_num_cpus; i++)
+ mm->context[cpu_logical_map(i)] = 0;
}
extern inline void
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)