diff options
author | Ariane van der Steldt <ariane@cvs.openbsd.org> | 2009-06-01 17:42:34 +0000 |
---|---|---|
committer | Ariane van der Steldt <ariane@cvs.openbsd.org> | 2009-06-01 17:42:34 +0000 |
commit | d30afc0ec38415711bc30130e9412a6026468e8b (patch) | |
tree | ee3b3b40a267f69f54dca2c401c95db8de083c91 /sys/arch | |
parent | f5deafb272a62d5cf541c0d5ded06c603823ad2f (diff) |
physmem allocator: change the view of free memory from single free pages
to free ranges.
Classify memory based on region with associated use-counter (which is used
to construct a priority list of where to allocate memory).
Based on code from tedu@, help from many.
Ok art@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/pmap.c | 10 | ||||
-rw-r--r-- | sys/arch/amd64/include/vmparam.h | 9 | ||||
-rw-r--r-- | sys/arch/i386/i386/pmap.c | 11 | ||||
-rw-r--r-- | sys/arch/i386/i386/pmapae.c | 15 | ||||
-rw-r--r-- | sys/arch/i386/include/vmparam.h | 9 |
5 files changed, 35 insertions, 19 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index 4bd4ba51f9f..fb46e417f84 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.42 2009/05/28 09:05:33 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.43 2009/06/01 17:42:33 ariane Exp $ */ /* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */ /* @@ -834,7 +834,7 @@ pmap_freepage(struct pmap *pmap, struct vm_page *ptp, int level, pmap->pm_ptphint[lidx] = TAILQ_FIRST(&obj->memq); ptp->wire_count = 0; uvm_pagerealloc(ptp, NULL, 0); - TAILQ_INSERT_TAIL(pagelist, ptp, listq); + TAILQ_INSERT_TAIL(pagelist, ptp, fq.queues.listq); } void @@ -1545,7 +1545,7 @@ pmap_do_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva, int flags) PMAP_MAP_TO_HEAD_UNLOCK(); while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { - TAILQ_REMOVE(&empty_ptps, ptp, listq); + TAILQ_REMOVE(&empty_ptps, ptp, fq.queues.listq); uvm_pagefree(ptp); } @@ -1617,7 +1617,7 @@ pmap_do_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva, int flags) PMAP_MAP_TO_HEAD_UNLOCK(); while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { - TAILQ_REMOVE(&empty_ptps, ptp, listq); + TAILQ_REMOVE(&empty_ptps, ptp, fq.queues.listq); uvm_pagefree(ptp); } } @@ -1690,7 +1690,7 @@ pmap_page_remove(struct vm_page *pg) pmap_tlb_shootwait(); while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { - TAILQ_REMOVE(&empty_ptps, ptp, listq); + TAILQ_REMOVE(&empty_ptps, ptp, fq.queues.listq); uvm_pagefree(ptp); } } diff --git a/sys/arch/amd64/include/vmparam.h b/sys/arch/amd64/include/vmparam.h index fd82b226db2..d3c5c9dd102 100644 --- a/sys/arch/amd64/include/vmparam.h +++ b/sys/arch/amd64/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.10 2008/07/18 16:40:17 kurt Exp $ */ +/* $OpenBSD: vmparam.h,v 1.11 2009/06/01 17:42:33 ariane Exp $ */ /* $NetBSD: vmparam.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */ /*- @@ -112,6 +112,13 @@ #define VM_FREELIST_LOW 1 #define VM_FREELIST_HIGH 2 +/* reserve ISA-DMA and 32-bit DMA memory */ +#define UVM_IO_RANGES \ + { \ + { 0, 0x00ffffffUL }, \ + { 0, 0xffffffffUL }, \ + } + #define __HAVE_VM_PAGE_MD struct pv_entry; struct vm_page_md { diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 753298eb42a..91fd6edb555 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.136 2009/02/05 01:13:21 oga Exp $ */ +/* $OpenBSD: pmap.c,v 1.137 2009/06/01 17:42:33 ariane Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -2074,7 +2074,7 @@ pmap_do_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva, int flags) /* If PTP is no longer being used, free it. */ if (ptp && ptp->wire_count <= 1) { pmap_drop_ptp(pmap, va, ptp, ptes); - TAILQ_INSERT_TAIL(&empty_ptps, ptp, listq); + TAILQ_INSERT_TAIL(&empty_ptps, ptp, fq.queues.listq); } if (!shootall) @@ -2088,7 +2088,7 @@ pmap_do_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva, int flags) pmap_unmap_ptes(pmap); PMAP_MAP_TO_HEAD_UNLOCK(); while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { - TAILQ_REMOVE(&empty_ptps, ptp, listq); + TAILQ_REMOVE(&empty_ptps, ptp, fq.queues.listq); uvm_pagefree(ptp); } } @@ -2145,7 +2145,8 @@ pmap_page_remove(struct vm_page *pg) if (pve->pv_ptp && --pve->pv_ptp->wire_count <= 1) { pmap_drop_ptp(pve->pv_pmap, pve->pv_va, pve->pv_ptp, ptes); - TAILQ_INSERT_TAIL(&empty_ptps, pve->pv_ptp, listq); + TAILQ_INSERT_TAIL(&empty_ptps, pve->pv_ptp, + fq.queues.listq); } pmap_tlb_shootpage(pve->pv_pmap, pve->pv_va); @@ -2158,7 +2159,7 @@ pmap_page_remove(struct vm_page *pg) pmap_tlb_shootwait(); while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { - TAILQ_REMOVE(&empty_ptps, ptp, listq); + TAILQ_REMOVE(&empty_ptps, ptp, fq.queues.listq); uvm_pagefree(ptp); } } diff --git a/sys/arch/i386/i386/pmapae.c b/sys/arch/i386/i386/pmapae.c index 683d282379a..b13ff7c9463 100644 --- a/sys/arch/i386/i386/pmapae.c +++ b/sys/arch/i386/i386/pmapae.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmapae.c,v 1.15 2009/01/27 22:14:13 miod Exp $ */ +/* $OpenBSD: pmapae.c,v 1.16 2009/06/01 17:42:33 ariane Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -1453,14 +1453,15 @@ pmap_remove_pae(struct pmap *pmap, vaddr_t sva, vaddr_t eva) ptp->wire_count = 0; /* Postpone free to after shootdown. */ uvm_pagerealloc(ptp, NULL, 0); - TAILQ_INSERT_TAIL(&empty_ptps, ptp, listq); + TAILQ_INSERT_TAIL(&empty_ptps, ptp, + fq.queues.listq); } } pmap_tlb_shootnow(cpumask); pmap_unmap_ptes_pae(pmap); /* unlock pmap */ PMAP_MAP_TO_HEAD_UNLOCK(); while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { - TAILQ_REMOVE(&empty_ptps, ptp, listq); + TAILQ_REMOVE(&empty_ptps, ptp, fq.queues.listq); uvm_pagefree(ptp); } return; @@ -1546,7 +1547,7 @@ pmap_remove_pae(struct pmap *pmap, vaddr_t sva, vaddr_t eva) ptp->wire_count = 0; /* Postpone free to after shootdown. */ uvm_pagerealloc(ptp, NULL, 0); - TAILQ_INSERT_TAIL(&empty_ptps, ptp, listq); + TAILQ_INSERT_TAIL(&empty_ptps, ptp, fq.queues.listq); } } @@ -1554,7 +1555,7 @@ pmap_remove_pae(struct pmap *pmap, vaddr_t sva, vaddr_t eva) pmap_unmap_ptes_pae(pmap); PMAP_MAP_TO_HEAD_UNLOCK(); while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { - TAILQ_REMOVE(&empty_ptps, ptp, listq); + TAILQ_REMOVE(&empty_ptps, ptp, fq.queues.listq); uvm_pagefree(ptp); } } @@ -1665,7 +1666,7 @@ pmap_page_remove_pae(struct vm_page *pg) /* Postpone free to after shootdown. */ uvm_pagerealloc(pve->pv_ptp, NULL, 0); TAILQ_INSERT_TAIL(&empty_ptps, pve->pv_ptp, - listq); + fq.queues.listq); } } pmap_unmap_ptes_pae(pve->pv_pmap); /* unlocks pmap */ @@ -1676,7 +1677,7 @@ pmap_page_remove_pae(struct vm_page *pg) PMAP_HEAD_TO_MAP_UNLOCK(); pmap_tlb_shootnow(cpumask); while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { - TAILQ_REMOVE(&empty_ptps, ptp, listq); + TAILQ_REMOVE(&empty_ptps, ptp, fq.queues.listq); uvm_pagefree(ptp); } } diff --git a/sys/arch/i386/include/vmparam.h b/sys/arch/i386/include/vmparam.h index 9c2163e6c2d..41e95b3f418 100644 --- a/sys/arch/i386/include/vmparam.h +++ b/sys/arch/i386/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.41 2008/07/18 16:40:17 kurt Exp $ */ +/* $OpenBSD: vmparam.h,v 1.42 2009/06/01 17:42:33 ariane Exp $ */ /* $NetBSD: vmparam.h,v 1.15 1994/10/27 04:16:34 cgd Exp $ */ /*- @@ -118,6 +118,13 @@ #define VM_FREELIST_DEFAULT 0 #define VM_FREELIST_FIRST16 1 +/* reserve ISA-DMA and 32-bit DMA memory */ +#define UVM_IO_RANGES \ + { \ + { 0, 0x00ffffffUL }, \ + { 0, 0xffffffffUL }, \ + } + #define __HAVE_VM_PAGE_MD struct pv_entry; struct vm_page_md { |