diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2015-07-19 21:21:15 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2015-07-19 21:21:15 +0000 |
commit | 7c2d7acf609fe68447193c9cd81d16ce3ebdbac0 (patch) | |
tree | 47011eb46ea689f66933f5795a753193e2c057ed /sys/uvm | |
parent | a5b2f81462552a9d606556817667dc9fe5899dc2 (diff) |
Change uvm_page[re]alloc_multi to actually use the flags passed in, and return
a value so that they may be called with UVM_PLA_NOWAIT
ok kettenis@
Diffstat (limited to 'sys/uvm')
-rw-r--r-- | sys/uvm/uvm_extern.h | 6 | ||||
-rw-r--r-- | sys/uvm/uvm_page.c | 60 |
2 files changed, 36 insertions, 30 deletions
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index 68b97337042..b7b78649ed9 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.132 2015/05/05 02:13:46 guenther Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.133 2015/07/19 21:21:14 beck Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -439,11 +439,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 e7ceaf39c65..c2831ebfb4e 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.c,v 1.138 2015/04/23 09:56:23 dlg Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.139 2015/07/19 21:21:14 beck Exp $ */ /* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */ /* @@ -801,27 +801,30 @@ 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); - i = 0; - while ((pg = TAILQ_FIRST(&plist)) != NULL) { - pg->wire_count = 1; - atomic_setbits_int(&pg->pg_flags, PG_CLEAN | PG_FAKE); - KASSERT((pg->pg_flags & PG_DEV) == 0); - TAILQ_REMOVE(&plist, pg, pageq); - uvm_pagealloc_pg(pg, obj, off + ptoa(i++), NULL); + flags); + if (r != 0) { + i = 0; + while ((pg = TAILQ_FIRST(&plist)) != NULL) { + pg->wire_count = 1; + atomic_setbits_int(&pg->pg_flags, PG_CLEAN | PG_FAKE); + KASSERT((pg->pg_flags & PG_DEV) == 0); + TAILQ_REMOVE(&plist, pg, pageq); + uvm_pagealloc_pg(pg, obj, off + ptoa(i++), NULL); + } } + return r; } /* @@ -829,33 +832,36 @@ 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); - i = 0; - while((pg = TAILQ_FIRST(&plist)) != NULL) { - offset = off + ptoa(i++); - tpg = uvm_pagelookup(obj, offset); - pg->wire_count = 1; - atomic_setbits_int(&pg->pg_flags, PG_CLEAN | PG_FAKE); - KASSERT((pg->pg_flags & PG_DEV) == 0); - TAILQ_REMOVE(&plist, pg, pageq); - uvm_pagecopy(tpg, pg); - uvm_pagefree(tpg); - uvm_pagealloc_pg(pg, obj, offset, NULL); + r = uvm_pglistalloc(size, where->ucr_low, where->ucr_high, 0, + 0, &plist, atop(round_page(size)), flags); + if (r != 0) { + i = 0; + while((pg = TAILQ_FIRST(&plist)) != NULL) { + offset = off + ptoa(i++); + tpg = uvm_pagelookup(obj, offset); + pg->wire_count = 1; + atomic_setbits_int(&pg->pg_flags, PG_CLEAN | PG_FAKE); + KASSERT((pg->pg_flags & PG_DEV) == 0); + TAILQ_REMOVE(&plist, pg, pageq); + uvm_pagecopy(tpg, pg); + uvm_pagefree(tpg); + uvm_pagealloc_pg(pg, obj, offset, NULL); + } } + return r; } /* |