diff options
-rw-r--r-- | sys/vm/vm_contig.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c index 905e848..25d9a3a 100644 --- a/sys/vm/vm_contig.c +++ b/sys/vm/vm_contig.c @@ -222,7 +222,8 @@ again1: m->valid = VM_PAGE_BITS_ALL; if (m->flags & PG_ZERO) vm_page_zero_count--; - m->flags = 0; + /* Don't clear the PG_ZERO flag, we'll need it later. */ + m->flags &= PG_ZERO; KASSERT(m->dirty == 0, ("contigmalloc1: page %p was dirty", m)); m->wire_count = 0; @@ -259,6 +260,9 @@ again1: vm_page_t m = &pga[i]; vm_page_insert(m, kernel_object, OFF_TO_IDX(tmp_addr - VM_MIN_KERNEL_ADDRESS)); + if ((flags & M_ZERO) && !(m->flags & PG_ZERO)) + bzero((void *)tmp_addr, PAGE_SIZE); + m->flags = 0; tmp_addr += PAGE_SIZE; } VM_OBJECT_UNLOCK(kernel_object); |