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/uvm_page.c | |
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/uvm_page.c')
-rw-r--r-- | sys/uvm/uvm_page.c | 60 |
1 files changed, 33 insertions, 27 deletions
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; } /* |