diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2013-06-11 19:01:21 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2013-06-11 19:01:21 +0000 |
commit | a04cd4407a8b46989eda57407c34a81fd0c94229 (patch) | |
tree | 582a477b3a0350d8234ed93d0ec5b3e361db2bb5 /sys/uvm | |
parent | b46bdc87d12f64a73dd9be1af6eea4e8c42f227e (diff) |
High memory page flipping for the buffer cache.
This change splits the buffer cache free lists into lists of dma reachable
buffers and high memory buffers based on the ranges returned by pmemrange.
Buffers move from dma to high memory as they age, but are flipped to dma
reachable memory if IO is needed to/from and high mem buffer. The total
amount of buffers allocated is now bufcachepercent of both the dma and
the high memory region.
This change allows the use of large buffer caches on amd64 using more than
4 GB of memory
ok tedu@ krw@ - testing by many.
Diffstat (limited to 'sys/uvm')
-rw-r--r-- | sys/uvm/uvm_extern.h | 6 | ||||
-rw-r--r-- | sys/uvm/uvm_page.c | 24 |
2 files changed, 18 insertions, 12 deletions
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index 55679c9175c..b2f0be0cb18 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.107 2013/05/23 01:42:59 tedu Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.108 2013/06/11 19:01:20 beck Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -680,11 +680,11 @@ struct vm_page *uvm_pagealloc(struct uvm_object *, voff_t, struct vm_anon *, int); vaddr_t uvm_pagealloc_contig(vaddr_t, vaddr_t, vaddr_t, vaddr_t); -void uvm_pagealloc_multi(struct uvm_object *, voff_t, +int uvm_pagealloc_multi(struct uvm_object *, voff_t, vsize_t, int); void uvm_pagerealloc(struct vm_page *, struct uvm_object *, voff_t); -void uvm_pagerealloc_multi(struct uvm_object *, voff_t, +int uvm_pagerealloc_multi(struct uvm_object *, voff_t, vsize_t, int, struct uvm_constraint_range *); /* Actually, uvm_page_physload takes PF#s which need their own type */ void uvm_page_physload(paddr_t, paddr_t, paddr_t, diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index 27cd5ad0b1c..b904577a544 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.c,v 1.125 2013/05/30 16:29:46 tedu Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.126 2013/06/11 19:01:20 beck Exp $ */ /* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */ /* @@ -876,19 +876,21 @@ uvm_pglistfree(struct pglist *list) * interface used by the buffer cache to allocate a buffer at a time. * The pages are allocated wired in DMA accessible memory */ -void +int uvm_pagealloc_multi(struct uvm_object *obj, voff_t off, vsize_t size, int flags) { struct pglist plist; struct vm_page *pg; - int i; + int i, r; TAILQ_INIT(&plist); - (void) uvm_pglistalloc(size, dma_constraint.ucr_low, + r = uvm_pglistalloc(size, dma_constraint.ucr_low, dma_constraint.ucr_high, 0, 0, &plist, atop(round_page(size)), - UVM_PLA_WAITOK); + flags); + if (r != 0) + return(r); i = 0; while ((pg = TAILQ_FIRST(&plist)) != NULL) { pg->wire_count = 1; @@ -897,6 +899,7 @@ uvm_pagealloc_multi(struct uvm_object *obj, voff_t off, vsize_t size, TAILQ_REMOVE(&plist, pg, pageq); uvm_pagealloc_pg(pg, obj, off + ptoa(i++), NULL); } + return(0); } /* @@ -904,21 +907,23 @@ uvm_pagealloc_multi(struct uvm_object *obj, voff_t off, vsize_t size, * The pages are reallocated wired outside the DMA accessible region. * */ -void +int uvm_pagerealloc_multi(struct uvm_object *obj, voff_t off, vsize_t size, int flags, struct uvm_constraint_range *where) { struct pglist plist; struct vm_page *pg, *tpg; - int i; + int i,r; voff_t offset; TAILQ_INIT(&plist); if (size == 0) panic("size 0 uvm_pagerealloc"); - (void) uvm_pglistalloc(size, where->ucr_low, where->ucr_high, 0, - 0, &plist, atop(round_page(size)), UVM_PLA_WAITOK); + r = uvm_pglistalloc(size, where->ucr_low, where->ucr_high, 0, + 0, &plist, atop(round_page(size)), flags); + if (r != 0) + return(r); i = 0; while((pg = TAILQ_FIRST(&plist)) != NULL) { offset = off + ptoa(i++); @@ -931,6 +936,7 @@ uvm_pagerealloc_multi(struct uvm_object *obj, voff_t off, vsize_t size, uvm_pagefree(tpg); uvm_pagealloc_pg(pg, obj, offset, NULL); } + return(0); } /* |