From 40ebf3e43a04f135fee386d8d766fc35055fcb82 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Jun 2003 02:57:38 +0000 Subject: [PATCH] Fix a performance bug in all of the various implementations of uma_small_alloc(): They always zeroed the page regardless of what the caller requested. --- sys/alpha/alpha/pmap.c | 2 +- sys/amd64/amd64/pmap.c | 2 +- sys/ia64/ia64/pmap.c | 2 +- sys/sparc64/sparc64/vm_machdep.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 55d46fba01a3..c14e42d16617 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -594,7 +594,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) } va = (void *)ALPHA_PHYS_TO_K0SEG(m->phys_addr); - if ((m->flags & PG_ZERO) == 0) + if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) bzero(va, PAGE_SIZE); return (va); } diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 8a3226b92129..93bd3acbeade 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -557,7 +557,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) } va = (void *)PHYS_TO_DMAP(m->phys_addr); - if ((m->flags & PG_ZERO) == 0) + if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) pagezero(va); return (va); } diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index 77effaa698ef..43405bdcfce1 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -539,7 +539,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) } va = (void *)IA64_PHYS_TO_RR7(VM_PAGE_TO_PHYS(m)); - if ((m->flags & PG_ZERO) == 0) + if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) bzero(va, PAGE_SIZE); return (va); } diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c index 7f54e122e48b..5b4b9ab299e1 100644 --- a/sys/sparc64/sparc64/vm_machdep.c +++ b/sys/sparc64/sparc64/vm_machdep.c @@ -370,7 +370,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) dcache_page_inval(pa); } va = (void *)TLB_PHYS_TO_DIRECT(pa); - if ((m->flags & PG_ZERO) == 0) + if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) bzero(va, PAGE_SIZE); return (va); }