diff options
author | alc <alc@FreeBSD.org> | 2002-11-13 05:39:58 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-11-13 05:39:58 +0000 |
commit | c02d224c79a209121012072dc916c2d61ce8c1e5 (patch) | |
tree | e422808e35d14010cfbd0e3bec778fcc4bba8771 /sys | |
parent | 51b18a9ea395df565a980577302fe8bc0f24ab8c (diff) | |
download | FreeBSD-src-c02d224c79a209121012072dc916c2d61ce8c1e5.zip FreeBSD-src-c02d224c79a209121012072dc916c2d61ce8c1e5.tar.gz |
Move pmap_collect() out of the machine-dependent code, rename it
to reflect its new location, and add page queue and flag locking.
Notes: (1) alpha, i386, and ia64 had identical implementations
of pmap_collect() in terms of machine-independent interfaces;
(2) sparc64 doesn't require it; (3) powerpc had it as a TODO.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/alpha/alpha/pmap.c | 32 | ||||
-rw-r--r-- | sys/amd64/amd64/pmap.c | 32 | ||||
-rw-r--r-- | sys/i386/i386/pmap.c | 32 | ||||
-rw-r--r-- | sys/ia64/ia64/pmap.c | 31 | ||||
-rw-r--r-- | sys/powerpc/aim/mmu_oea.c | 6 | ||||
-rw-r--r-- | sys/powerpc/powerpc/mmu_oea.c | 6 | ||||
-rw-r--r-- | sys/powerpc/powerpc/pmap.c | 6 | ||||
-rw-r--r-- | sys/sparc64/include/pmap.h | 2 | ||||
-rw-r--r-- | sys/sparc64/sparc64/pmap.c | 9 | ||||
-rw-r--r-- | sys/vm/pmap.h | 3 | ||||
-rw-r--r-- | sys/vm/vm_pageout.c | 32 |
11 files changed, 37 insertions, 154 deletions
diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 5451a00..24d6a0a 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -323,7 +323,7 @@ static struct mtx allpmaps_lock; */ static uma_zone_t pvzone; static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; -static int pmap_pagedaemon_waken = 0; +int pmap_pagedaemon_waken; static PMAP_INLINE void free_pv_entry(pv_entry_t pv); static pv_entry_t get_pv_entry(void); @@ -1724,36 +1724,6 @@ get_pv_entry(void) } /* - * This routine is very drastic, but can save the system - * in a pinch. - */ -void -pmap_collect() -{ - int i; - vm_page_t m; - static int warningdone = 0; - - if (pmap_pagedaemon_waken == 0) - return; - - if (warningdone < 5) { - printf("pmap_collect: collecting pv entries -- suggest increasing PMAP_SHPGPERPROC\n"); - warningdone++; - } - - for(i = 0; i < vm_page_array_size; i++) { - m = &vm_page_array[i]; - if (m->wire_count || m->hold_count || m->busy || - (m->flags & (PG_BUSY | PG_UNMANAGED))) - continue; - pmap_remove_all(m); - } - pmap_pagedaemon_waken = 0; -} - - -/* * If it is the first entry on the list, it is actually * in the header and we must copy the following entry up * to the header. Otherwise we must search the list for diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index e783b28..b0e43ba 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -173,7 +173,7 @@ extern u_int32_t KERNend; static uma_zone_t pvzone; static struct vm_object pvzone_obj; static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; -static int pmap_pagedaemon_waken = 0; +int pmap_pagedaemon_waken; /* * All those kernel PT submaps that BSD is so fond of @@ -1619,36 +1619,6 @@ get_pv_entry(void) } /* - * This routine is very drastic, but can save the system - * in a pinch. - */ -void -pmap_collect() -{ - int i; - vm_page_t m; - static int warningdone = 0; - - if (pmap_pagedaemon_waken == 0) - return; - - if (warningdone < 5) { - printf("pmap_collect: collecting pv entries -- suggest increasing PMAP_SHPGPERPROC\n"); - warningdone++; - } - - for(i = 0; i < vm_page_array_size; i++) { - m = &vm_page_array[i]; - if (m->wire_count || m->hold_count || m->busy || - (m->flags & (PG_BUSY | PG_UNMANAGED))) - continue; - pmap_remove_all(m); - } - pmap_pagedaemon_waken = 0; -} - - -/* * If it is the first entry on the list, it is actually * in the header and we must copy the following entry up * to the header. Otherwise we must search the list for diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index e783b28..b0e43ba 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -173,7 +173,7 @@ extern u_int32_t KERNend; static uma_zone_t pvzone; static struct vm_object pvzone_obj; static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; -static int pmap_pagedaemon_waken = 0; +int pmap_pagedaemon_waken; /* * All those kernel PT submaps that BSD is so fond of @@ -1619,36 +1619,6 @@ get_pv_entry(void) } /* - * This routine is very drastic, but can save the system - * in a pinch. - */ -void -pmap_collect() -{ - int i; - vm_page_t m; - static int warningdone = 0; - - if (pmap_pagedaemon_waken == 0) - return; - - if (warningdone < 5) { - printf("pmap_collect: collecting pv entries -- suggest increasing PMAP_SHPGPERPROC\n"); - warningdone++; - } - - for(i = 0; i < vm_page_array_size; i++) { - m = &vm_page_array[i]; - if (m->wire_count || m->hold_count || m->busy || - (m->flags & (PG_BUSY | PG_UNMANAGED))) - continue; - pmap_remove_all(m); - } - pmap_pagedaemon_waken = 0; -} - - -/* * If it is the first entry on the list, it is actually * in the header and we must copy the following entry up * to the header. Otherwise we must search the list for diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index a36a776..cc271c6 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -228,7 +228,7 @@ struct mtx pmap_ridmutex; */ static uma_zone_t pvzone; static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; -static int pmap_pagedaemon_waken = 0; +int pmap_pagedaemon_waken; static struct pv_entry *pvbootentries; static int pvbootnext, pvbootmax; @@ -1420,35 +1420,6 @@ pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot) } /* - * This routine is very drastic, but can save the system - * in a pinch. - */ -void -pmap_collect() -{ - int i; - vm_page_t m; - static int warningdone = 0; - - if (pmap_pagedaemon_waken == 0) - return; - - if (warningdone < 5) { - printf("pmap_collect: collecting pv entries -- suggest increasing PMAP_SHPGPERPROC\n"); - warningdone++; - } - - for(i = 0; i < vm_page_array_size; i++) { - m = &vm_page_array[i]; - if (m->wire_count || m->hold_count || m->busy || - (m->flags & (PG_BUSY | PG_UNMANAGED))) - continue; - pmap_remove_all(m); - } - pmap_pagedaemon_waken = 0; -} - -/* * Remove a single page from a process address space */ static void diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 2aca63e..df134b1 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -871,12 +871,6 @@ pmap_clear_modify(vm_page_t m) } void -pmap_collect(void) -{ - TODO; -} - -void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c index 2aca63e..df134b1 100644 --- a/sys/powerpc/powerpc/mmu_oea.c +++ b/sys/powerpc/powerpc/mmu_oea.c @@ -871,12 +871,6 @@ pmap_clear_modify(vm_page_t m) } void -pmap_collect(void) -{ - TODO; -} - -void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { diff --git a/sys/powerpc/powerpc/pmap.c b/sys/powerpc/powerpc/pmap.c index 2aca63e..df134b1 100644 --- a/sys/powerpc/powerpc/pmap.c +++ b/sys/powerpc/powerpc/pmap.c @@ -871,12 +871,6 @@ pmap_clear_modify(vm_page_t m) } void -pmap_collect(void) -{ - TODO; -} - -void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { diff --git a/sys/sparc64/include/pmap.h b/sys/sparc64/include/pmap.h index faa3651..fdb5b9b 100644 --- a/sys/sparc64/include/pmap.h +++ b/sys/sparc64/include/pmap.h @@ -104,8 +104,6 @@ extern vm_offset_t phys_avail[]; extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; -extern int pmap_pagedaemon_waken; - extern vm_offset_t msgbuf_phys; static __inline int diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index 485349c..219a0cc 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -1278,15 +1278,6 @@ pmap_growkernel(vm_offset_t addr) panic("pmap_growkernel: can't grow kernel"); } -/* - * This routine is very drastic, but can save the system - * in a pinch. - */ -void -pmap_collect(void) -{ -} - int pmap_remove_tte(struct pmap *pm, struct pmap *pm2, struct tte *tp, vm_offset_t va) diff --git a/sys/vm/pmap.h b/sys/vm/pmap.h index 1511e4a..38bde18 100644 --- a/sys/vm/pmap.h +++ b/sys/vm/pmap.h @@ -89,13 +89,14 @@ typedef struct pmap_statistics *pmap_statistics_t; struct proc; struct thread; +extern int pmap_pagedaemon_waken; + #ifdef __alpha__ void pmap_page_is_free(vm_page_t m); #endif void pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); void pmap_clear_modify(vm_page_t m); void pmap_clear_reference(vm_page_t m); -void pmap_collect(void); void pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); void pmap_copy_page(vm_page_t, vm_page_t); void pmap_enter(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 00569a0..db27af9 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -109,6 +109,7 @@ /* the kernel process "vm_pageout"*/ static void vm_pageout(void); static int vm_pageout_clean(vm_page_t); +static void vm_pageout_pmap_collect(void); static void vm_pageout_scan(int pass); static int vm_pageout_free_page_calc(vm_size_t count); struct proc *pageproc; @@ -626,6 +627,35 @@ vm_pageout_page_free(vm_page_t m) { } /* + * This routine is very drastic, but can save the system + * in a pinch. + */ +static void +vm_pageout_pmap_collect(void) +{ + int i; + vm_page_t m; + static int warningdone; + + if (pmap_pagedaemon_waken == 0) + return; + if (warningdone < 5) { + printf("collecting pv entries -- suggest increasing PMAP_SHPGPERPROC\n"); + warningdone++; + } + vm_page_lock_queues(); + for (i = 0; i < vm_page_array_size; i++) { + m = &vm_page_array[i]; + if (m->wire_count || m->hold_count || m->busy || + (m->flags & (PG_BUSY | PG_UNMANAGED))) + continue; + pmap_remove_all(m); + } + vm_page_unlock_queues(); + pmap_pagedaemon_waken = 0; +} + +/* * vm_pageout_scan does the dirty work for the pageout daemon. */ static void @@ -650,7 +680,7 @@ vm_pageout_scan(int pass) /* * Do whatever cleanup that the pmap code can. */ - pmap_collect(); + vm_pageout_pmap_collect(); uma_reclaim(); addl_page_shortage_init = vm_pageout_deficit; |