patch-2.1.115 linux/arch/sparc/mm/srmmu.c
Next file: linux/arch/sparc/mm/sun4c.c
Previous file: linux/arch/sparc/mm/Makefile
Back to the patch index
Back to the overall index
- Lines: 151
- Date:
Tue Aug 4 16:03:35 1998
- Orig file:
v2.1.114/linux/arch/sparc/mm/srmmu.c
- Orig date:
Fri May 8 23:14:46 1998
diff -u --recursive --new-file v2.1.114/linux/arch/sparc/mm/srmmu.c linux/arch/sparc/mm/srmmu.c
@@ -1,4 +1,4 @@
-/* $Id: srmmu.c,v 1.171 1998/04/24 15:03:35 jj Exp $
+/* $Id: srmmu.c,v 1.173 1998/08/04 20:48:57 davem Exp $
* srmmu.c: SRMMU specific routines for memory management.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -1034,7 +1034,7 @@
FLUSH_BEGIN(mm)
flush_user_windows();
- save_and_cli(flags);
+ __save_and_cli(flags);
octx = srmmu_get_context();
srmmu_set_context(mm->context);
a = 0x20; b = 0x40; c = 0x60;
@@ -1058,7 +1058,7 @@
"r" (e), "r" (f), "r" (g));
} while(faddr);
srmmu_set_context(octx);
- restore_flags(flags);
+ __restore_flags(flags);
FLUSH_END
}
@@ -1070,7 +1070,7 @@
FLUSH_BEGIN(mm)
flush_user_windows();
- save_and_cli(flags);
+ __save_and_cli(flags);
octx = srmmu_get_context();
srmmu_set_context(mm->context);
a = 0x20; b = 0x40; c = 0x60;
@@ -1099,7 +1099,7 @@
start += SRMMU_PMD_SIZE;
}
srmmu_set_context(octx);
- restore_flags(flags);
+ __restore_flags(flags);
FLUSH_END
}
@@ -1112,7 +1112,7 @@
FLUSH_BEGIN(mm)
flush_user_windows();
- save_and_cli(flags);
+ __save_and_cli(flags);
octx = srmmu_get_context();
srmmu_set_context(mm->context);
a = 0x20; b = 0x40; c = 0x60;
@@ -1138,7 +1138,7 @@
"r" (e), "r" (f), "r" (g));
} while(line != page);
srmmu_set_context(octx);
- restore_flags(flags);
+ __restore_flags(flags);
FLUSH_END
}
@@ -2019,7 +2019,7 @@
pmd_t *pmdp;
pte_t *ptep;
- save_and_cli(flags);
+ __save_and_cli(flags);
file = vma->vm_file;
if (!file)
@@ -2065,7 +2065,7 @@
flush_tlb_page(vma, address);
}
done:
- restore_flags(flags);
+ __restore_flags(flags);
}
}
@@ -2722,16 +2722,12 @@
srmmu_is_bad();
}
-/* Low and high watermarks for page table cache.
- The system should try to have pgt_water[0] <= cache elements <= pgt_water[1]
- */
-extern int pgt_cache_water[2];
-
-void srmmu_check_pgt_cache(void)
+static int srmmu_check_pgt_cache(int low, int high)
{
struct page *page, *page2;
+ int freed = 0;
- if (pgtable_cache_size > pgt_cache_water[0]) {
+ if (pgtable_cache_size > high) {
spin_lock(&pte_spinlock);
for (page2 = NULL, page = (struct page *)pte_quicklist; page;) {
if ((unsigned int)page->pprev_hash == 0xffff) {
@@ -2743,11 +2739,12 @@
page->pprev_hash = NULL;
pgtable_cache_size -= 16;
free_page(PAGE_OFFSET + (page->map_nr << PAGE_SHIFT));
+ freed++;
if (page2)
page = page2->next_hash;
else
page = (struct page *)pte_quicklist;
- if (pgtable_cache_size <= pgt_cache_water[1])
+ if (pgtable_cache_size <= low)
break;
continue;
}
@@ -2756,7 +2753,7 @@
}
spin_unlock(&pte_spinlock);
}
- if (pgd_cache_size > pgt_cache_water[0] / 4) {
+ if (pgd_cache_size > high / 4) {
spin_lock(&pgd_spinlock);
for (page2 = NULL, page = (struct page *)pgd_quicklist; page;) {
if ((unsigned int)page->pprev_hash == 0xf) {
@@ -2768,11 +2765,12 @@
page->pprev_hash = NULL;
pgd_cache_size -= 4;
free_page(PAGE_OFFSET + (page->map_nr << PAGE_SHIFT));
+ freed++;
if (page2)
page = page2->next_hash;
else
page = (struct page *)pgd_quicklist;
- if (pgd_cache_size <= pgt_cache_water[1] / 4)
+ if (pgd_cache_size <= low / 4)
break;
continue;
}
@@ -2781,6 +2779,7 @@
}
spin_unlock(&pgd_spinlock);
}
+ return freed;
}
extern unsigned long spwin_mmu_patchme, fwin_mmu_patchme,
@@ -2853,6 +2852,7 @@
BTFIXUPSET_CALL(get_pgd_fast, srmmu_get_pgd_fast, BTFIXUPCALL_RETINT(0));
BTFIXUPSET_CALL(free_pte_slow, srmmu_free_pte_slow, BTFIXUPCALL_NOP);
BTFIXUPSET_CALL(free_pgd_slow, srmmu_free_pgd_slow, BTFIXUPCALL_NOP);
+ BTFIXUPSET_CALL(do_check_pgt_cache, srmmu_check_pgt_cache, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(set_pgdir, srmmu_set_pgdir, BTFIXUPCALL_NORM);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov