Print this page
5255 uts shouldn't open-code ISP2

*** 918,928 **** { int hb; int flist = 0; ASSERT(MUTEX_HELD(&vmp->vm_lock)); ! if ((size & (size - 1)) == 0) flist = lowbit(P2ALIGN(vmp->vm_freemap, size)); else if ((hb = highbit(size)) < VMEM_FREELISTS) flist = lowbit(P2ALIGN(vmp->vm_freemap, 1UL << hb)); return (flist); --- 918,928 ---- { int hb; int flist = 0; ASSERT(MUTEX_HELD(&vmp->vm_lock)); ! if (ISP2(size)) flist = lowbit(P2ALIGN(vmp->vm_freemap, size)); else if ((hb = highbit(size)) < VMEM_FREELISTS) flist = lowbit(P2ALIGN(vmp->vm_freemap, 1UL << hb)); return (flist);
*** 957,968 **** panic("vmem_xalloc(%p, %lu, %lu, %lu, %lu, %p, %p, %x): " "overconstrained allocation", (void *)vmp, size, align_arg, phase, nocross, minaddr, maxaddr, vmflag); ! if (phase >= align || (align & (align - 1)) != 0 || ! (nocross & (nocross - 1)) != 0) panic("vmem_xalloc(%p, %lu, %lu, %lu, %lu, %p, %p, %x): " "parameters inconsistent or invalid", (void *)vmp, size, align_arg, phase, nocross, minaddr, maxaddr, vmflag); --- 957,967 ---- panic("vmem_xalloc(%p, %lu, %lu, %lu, %lu, %p, %p, %x): " "overconstrained allocation", (void *)vmp, size, align_arg, phase, nocross, minaddr, maxaddr, vmflag); ! if (phase >= align || !ISP2(align) || !ISP2(nocross)) panic("vmem_xalloc(%p, %lu, %lu, %lu, %lu, %p, %p, %x): " "parameters inconsistent or invalid", (void *)vmp, size, align_arg, phase, nocross, minaddr, maxaddr, vmflag);
*** 992,1002 **** * (3) We're in the highest possible freelist, which is * always empty (e.g. the 4GB freelist on 32-bit systems); * * (4) We're doing a best-fit or first-fit allocation. */ ! if ((size & (size - 1)) == 0) { flist = lowbit(P2ALIGN(vmp->vm_freemap, size)); } else { hb = highbit(size); if ((vmp->vm_freemap >> hb) == 0 || hb == VMEM_FREELISTS || --- 991,1001 ---- * (3) We're in the highest possible freelist, which is * always empty (e.g. the 4GB freelist on 32-bit systems); * * (4) We're doing a best-fit or first-fit allocation. */ ! if (ISP2(size)) { flist = lowbit(P2ALIGN(vmp->vm_freemap, size)); } else { hb = highbit(size); if ((vmp->vm_freemap >> hb) == 0 || hb == VMEM_FREELISTS ||
*** 1288,1298 **** * Unconstrained instant-fit allocation from the segment list. */ mutex_enter(&vmp->vm_lock); if (vmp->vm_nsegfree >= VMEM_MINFREE || vmem_populate(vmp, vmflag)) { ! if ((size & (size - 1)) == 0) flist = lowbit(P2ALIGN(vmp->vm_freemap, size)); else if ((hb = highbit(size)) < VMEM_FREELISTS) flist = lowbit(P2ALIGN(vmp->vm_freemap, 1UL << hb)); } --- 1287,1297 ---- * Unconstrained instant-fit allocation from the segment list. */ mutex_enter(&vmp->vm_lock); if (vmp->vm_nsegfree >= VMEM_MINFREE || vmem_populate(vmp, vmflag)) { ! if (ISP2(size)) flist = lowbit(P2ALIGN(vmp->vm_freemap, size)); else if ((hb = highbit(size)) < VMEM_FREELISTS) flist = lowbit(P2ALIGN(vmp->vm_freemap, 1UL << hb)); }