diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20240724: deprecate contigfree(9) +OLD_FILES+=usr/share/man/man9/contigfree.9.gz + # 20240716: retire mergemaster OLD_FILES+=usr/sbin/mergemaster OLD_FILES+=usr/share/man/man8/mergemaster.8.gz diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -885,8 +885,7 @@ config_intrhook.9 config_intrhook_drain.9 \ config_intrhook.9 config_intrhook_establish.9 \ config_intrhook.9 config_intrhook_oneshot.9 -MLINKS+=contigmalloc.9 contigmalloc_domainset.9 \ - contigmalloc.9 contigfree.9 +MLINKS+=contigmalloc.9 contigmalloc_domainset.9 MLINKS+=casuword.9 casueword.9 \ casuword.9 casueword32.9 \ casuword.9 casuword32.9 diff --git a/share/man/man9/contigmalloc.9 b/share/man/man9/contigmalloc.9 --- a/share/man/man9/contigmalloc.9 +++ b/share/man/man9/contigmalloc.9 @@ -23,11 +23,11 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 22, 2024 +.Dd July 24, 2024 .Dt CONTIGMALLOC 9 .Os .Sh NAME -.Nm contigmalloc , contigfree +.Nm contigmalloc .Nd manage contiguous kernel physical memory .Sh SYNOPSIS .In sys/types.h @@ -42,12 +42,6 @@ .Fa "unsigned long alignment" .Fa "vm_paddr_t boundary" .Fc -.Ft void -.Fo contigfree -.Fa "void *addr" -.Fa "unsigned long size" -.Fa "struct malloc_type *type" -.Fc .In sys/param.h .In sys/domainset.h .Ft "void *" @@ -109,17 +103,10 @@ .Pp The .Fn contigfree -function deallocates memory allocated by a previous call to -.Fn contigmalloc -or -.Fn contigmalloc_domainset . -Its use is deprecated in favor of -.Xr free 9 -which no longer requires the caller to know the -.Fa size -and also accepts -.Dv NULL -as an address. +function is deprecated. +Use +.Xr free(9) +instead. .Sh IMPLEMENTATION NOTES The .Fn contigmalloc @@ -130,12 +117,6 @@ is specified, it may select a page for reclamation that must first be written to backing storage, causing it to sleep. .Pp -The -.Fn contigfree -function does not accept -.Dv NULL -as an address input, unlike -.Xr free 9 . .Sh RETURN VALUES The .Fn contigmalloc diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c --- a/sys/amd64/acpica/acpi_wakeup.c +++ b/sys/amd64/acpica/acpi_wakeup.c @@ -361,8 +361,7 @@ return; freepages: - if (*wakeaddr != NULL) - contigfree(*wakeaddr, PAGE_SIZE, M_DEVBUF); + free(*wakeaddr, M_DEVBUF); for (i = 0; i < ACPI_WAKEPT_PAGES; i++) { if (wakept_m[i] != NULL) vm_page_free(wakept_m[i]); diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c --- a/sys/amd64/vmm/amd/svm.c +++ b/sys/amd64/vmm/amd/svm.c @@ -2259,8 +2259,8 @@ { struct svm_softc *sc = vmi; - contigfree(sc->iopm_bitmap, SVM_IO_BITMAP_SIZE, M_SVM); - contigfree(sc->msr_bitmap, SVM_MSR_BITMAP_SIZE, M_SVM); + free(sc->iopm_bitmap, M_SVM); + free(sc->msr_bitmap, M_SVM); free(sc, M_SVM); } diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -605,7 +605,7 @@ /* * Free a piece of memory and it's allociated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. + * via bus_dmamem_alloc. */ static void bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -158,7 +158,6 @@ struct lpi_chunk lpis; /* Virtual address of ITT */ void *itt; - size_t itt_size; }; /* @@ -1412,7 +1411,7 @@ struct gicv3_its_softc *sc; struct its_dev *its_dev; vmem_addr_t irq_base; - size_t esize; + size_t esize, itt_size; sc = device_get_softc(dev); @@ -1450,8 +1449,8 @@ * Allocate ITT for this device. * PA has to be 256 B aligned. At least two entries for device. */ - its_dev->itt_size = roundup2(MAX(nvecs, 2) * esize, 256); - its_dev->itt = contigmalloc_domainset(its_dev->itt_size, + itt_size = roundup2(MAX(nvecs, 2) * esize, 256); + its_dev->itt = contigmalloc_domainset(itt_size, M_GICV3_ITS, sc->sc_ds, M_NOWAIT | M_ZERO, 0, LPI_INT_TRANS_TAB_MAX_ADDR, LPI_INT_TRANS_TAB_ALIGN, 0); if (its_dev->itt == NULL) { @@ -1462,7 +1461,7 @@ /* Make sure device sees zeroed ITT. */ if ((sc->sc_its_flags & ITS_FLAGS_CMDQ_FLUSH) != 0) - cpu_dcache_wb_range(its_dev->itt, its_dev->itt_size); + cpu_dcache_wb_range(its_dev->itt, itt_size); mtx_lock_spin(&sc->sc_its_dev_lock); TAILQ_INSERT_TAIL(&sc->sc_its_dev_list, its_dev, entry); @@ -1494,7 +1493,7 @@ /* Free ITT */ KASSERT(its_dev->itt != NULL, ("Invalid ITT in valid ITS device")); - contigfree(its_dev->itt, its_dev->itt_size, M_GICV3_ITS); + free(its_dev->itt, M_GICV3_ITS); /* Free the IRQ allocation */ vmem_free(sc->sc_irq_alloc, its_dev->lpis.lpi_base, diff --git a/sys/arm64/include/bus_dma.h b/sys/arm64/include/bus_dma.h --- a/sys/arm64/include/bus_dma.h +++ b/sys/arm64/include/bus_dma.h @@ -62,7 +62,7 @@ /* * Free a piece of memory and it's allociated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. + * via bus_dmamem_alloc. */ static inline void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c --- a/sys/arm64/iommu/smmu.c +++ b/sys/arm64/iommu/smmu.c @@ -847,7 +847,6 @@ return (ENXIO); } - cd->size = size; cd->paddr = vtophys(cd->vaddr); ptr = cd->vaddr; @@ -962,7 +961,7 @@ strtab->l1 = malloc(sz, M_SMMU, M_WAITOK | M_ZERO); if (strtab->l1 == NULL) { - contigfree(strtab->vaddr, l1size, M_SMMU); + free(strtab->vaddr, M_SMMU); return (ENOMEM); } @@ -1014,7 +1013,6 @@ size = 1 << (STRTAB_SPLIT + ilog2(STRTAB_STE_DWORDS) + 3); l1_desc->span = STRTAB_SPLIT + 1; - l1_desc->size = size; l1_desc->va = contigmalloc(size, M_SMMU, M_WAITOK | M_ZERO, /* flags */ 0, /* low */ @@ -1057,7 +1055,7 @@ *addr = 0; l1_desc = &strtab->l1[sid >> STRTAB_SPLIT]; - contigfree(l1_desc->va, l1_desc->size, M_SMMU); + free(l1_desc->va, M_SMMU); } static int @@ -1765,7 +1763,7 @@ smmu_tlbi_asid(sc, domain->asid); smmu_asid_free(sc, domain->asid); - contigfree(cd->vaddr, cd->size, M_SMMU); + free(cd->vaddr, M_SMMU); free(cd, M_SMMU); free(domain, M_SMMU); diff --git a/sys/arm64/iommu/smmuvar.h b/sys/arm64/iommu/smmuvar.h --- a/sys/arm64/iommu/smmuvar.h +++ b/sys/arm64/iommu/smmuvar.h @@ -82,7 +82,6 @@ struct smmu_cd { vm_paddr_t paddr; - vm_size_t size; void *vaddr; }; @@ -121,7 +120,6 @@ struct l1_desc { uint8_t span; - size_t size; void *va; vm_paddr_t pa; }; diff --git a/sys/compat/x86bios/x86bios.c b/sys/compat/x86bios/x86bios.c --- a/sys/compat/x86bios/x86bios.c +++ b/sys/compat/x86bios/x86bios.c @@ -162,7 +162,7 @@ x86bios_vmc.npages--; } mtx_unlock(&x86bios_lock); - contigfree(addr, size, M_DEVBUF); + free(addr, M_DEVBUF); } void @@ -564,7 +564,7 @@ bzero(x86bios_map + paddr / X86BIOS_PAGE_SIZE, sizeof(*x86bios_map) * howmany(size, X86BIOS_PAGE_SIZE)); mtx_unlock(&x86bios_lock); - contigfree(addr, size, M_DEVBUF); + free(addr, M_DEVBUF); } void @@ -669,7 +669,7 @@ if (x86bios_rom != NULL) pmap_unmapdev(x86bios_rom, X86BIOS_ROM_SIZE); if (x86bios_seg != NULL) { - contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF); + free(x86bios_seg, M_DEVBUF); x86bios_seg = NULL; } } diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c --- a/sys/dev/agp/agp_i810.c +++ b/sys/dev/agp/agp_i810.c @@ -1796,7 +1796,7 @@ vm_page_unwire(m, PQ_INACTIVE); VM_OBJECT_WUNLOCK(mem->am_obj); } else { - contigfree(sc->argb_cursor, mem->am_size, M_AGP); + free(sc->argb_cursor, M_AGP); sc->argb_cursor = NULL; } } diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c --- a/sys/dev/bwn/if_bwn.c +++ b/sys/dev/bwn/if_bwn.c @@ -2987,11 +2987,7 @@ return (dr); fail2: - if (dr->dr_txhdr_cache != NULL) { - contigfree(dr->dr_txhdr_cache, - (dr->dr_numslots / BWN_TX_SLOTS_PER_FRAME) * - BWN_MAXTXHDRSIZE, M_DEVBUF); - } + free(dr->dr_txhdr_cache, M_DEVBUF); fail1: free(dr->dr_meta, M_DEVBUF); fail0: @@ -3009,11 +3005,7 @@ bwn_dma_free_descbufs(*dr); bwn_dma_free_ringmemory(*dr); - if ((*dr)->dr_txhdr_cache != NULL) { - contigfree((*dr)->dr_txhdr_cache, - ((*dr)->dr_numslots / BWN_TX_SLOTS_PER_FRAME) * - BWN_MAXTXHDRSIZE, M_DEVBUF); - } + free((*dr)->dr_txhdr_cache, M_DEVBUF); free((*dr)->dr_meta, M_DEVBUF); free(*dr, M_DEVBUF); diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -181,7 +181,7 @@ free_ddp_rcv_buffer(struct toepcb *toep, struct ddp_rcv_buffer *drb) { t4_free_page_pods(&drb->prsv); - contigfree(drb->buf, drb->len, M_CXGBE); + free(drb->buf, M_CXGBE); free(drb, M_CXGBE); counter_u64_add(toep->ofld_rxq->ddp_buffer_free, 1); free_toepcb(toep); @@ -242,7 +242,7 @@ error = t4_alloc_page_pods_for_rcvbuf(&td->pr, drb); if (error != 0) { - contigfree(drb->buf, drb->len, M_CXGBE); + free(drb->buf, M_CXGBE); free(drb, M_CXGBE); return (NULL); } @@ -250,7 +250,7 @@ error = t4_write_page_pods_for_rcvbuf(sc, toep->ctrlq, toep->tid, drb); if (error != 0) { t4_free_page_pods(&drb->prsv); - contigfree(drb->buf, drb->len, M_CXGBE); + free(drb->buf, M_CXGBE); free(drb, M_CXGBE); return (NULL); } diff --git a/sys/dev/dcons/dcons_os.c b/sys/dev/dcons/dcons_os.c --- a/sys/dev/dcons/dcons_os.c +++ b/sys/dev/dcons/dcons_os.c @@ -442,7 +442,7 @@ dcons_detach(DCONS_GDB); dg.buf->magic = 0; - contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF); + free(dg.buf, M_DEVBUF); } /* Wait for tty deferred free callbacks to complete. */ diff --git a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c --- a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c +++ b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c @@ -146,9 +146,9 @@ M_DEVBUF, M_WAITOK, BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); } -static __inline void free_pages(void *p, int order) +static __inline void free_pages(void *p) { - contigfree(p, PAGE_SIZE<vbus, &bus); HPT_ASSERT(p); - free_pages(p, 0); + free_pages(p); } for (f=vbus_ext->freelist_dma_head; f; f=f->next) { @@ -244,7 +244,7 @@ while ((p=freelist_get_dma(f, &bus))) { if (order) - free_pages(p, order); + free_pages(p); else { /* can't free immediately since other blocks in this page may still be in the list */ if (((HPT_UPTR)p & (PAGE_SIZE-1))==0) @@ -254,7 +254,7 @@ } while ((p = dmapool_get_page((PVBUS)vbus_ext->vbus, &bus))) - free_pages(p, 0); + free_pages(p); } static int hpt_init_vbus(PVBUS_EXT vbus_ext) diff --git a/sys/dev/hptmv/entry.c b/sys/dev/hptmv/entry.c --- a/sys/dev/hptmv/entry.c +++ b/sys/dev/hptmv/entry.c @@ -914,7 +914,7 @@ { MV_ERROR("RR18xx[%d]: Error in Request Quueues Alignment\n", pAdapter->mvSataAdapter.adapterId); - contigfree(pAdapter->requestsArrayBaseAddr, REQUESTS_ARRAY_SIZE, M_DEVBUF); + free(pAdapter->requestsArrayBaseAddr, M_DEVBUF); return -1; } /* response queues */ @@ -924,7 +924,7 @@ { MV_ERROR("RR18xx[%d]: Failed to allocate memory for EDMA response" " queues\n", pAdapter->mvSataAdapter.adapterId); - contigfree(pAdapter->requestsArrayBaseAddr, RESPONSES_ARRAY_SIZE, M_DEVBUF); + free(pAdapter->requestsArrayBaseAddr, M_DEVBUF); return -1; } pAdapter->responsesArrayBaseDmaAddr = fOsPhysicalAddress(pAdapter->responsesArrayBaseAddr); @@ -941,8 +941,8 @@ { MV_ERROR("RR18xx[%d]: Error in Response Queues Alignment\n", pAdapter->mvSataAdapter.adapterId); - contigfree(pAdapter->requestsArrayBaseAddr, REQUESTS_ARRAY_SIZE, M_DEVBUF); - contigfree(pAdapter->responsesArrayBaseAddr, RESPONSES_ARRAY_SIZE, M_DEVBUF); + free(pAdapter->requestsArrayBaseAddr, M_DEVBUF); + free(pAdapter->responsesArrayBaseAddr, M_DEVBUF); return -1; } return 0; @@ -951,8 +951,8 @@ static void hptmv_free_edma_queues(IAL_ADAPTER_T *pAdapter) { - contigfree(pAdapter->requestsArrayBaseAddr, REQUESTS_ARRAY_SIZE, M_DEVBUF); - contigfree(pAdapter->responsesArrayBaseAddr, RESPONSES_ARRAY_SIZE, M_DEVBUF); + free(pAdapter->requestsArrayBaseAddr, M_DEVBUF); + free(pAdapter->responsesArrayBaseAddr, M_DEVBUF); } static PVOID @@ -2950,13 +2950,13 @@ void os_free_page(_VBUS_ARG void *p) { - contigfree(p, 0x1000, M_DEVBUF); + free(p, M_DEVBUF); } void os_free_dma_page(_VBUS_ARG void *p) { - contigfree(p, 0x1000, M_DEVBUF); + free(p, M_DEVBUF); } void diff --git a/sys/dev/hptnr/hptnr_osm_bsd.c b/sys/dev/hptnr/hptnr_osm_bsd.c --- a/sys/dev/hptnr/hptnr_osm_bsd.c +++ b/sys/dev/hptnr/hptnr_osm_bsd.c @@ -143,9 +143,9 @@ M_DEVBUF, M_WAITOK, BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); } -static __inline void free_pages(void *p, int order) +static __inline void free_pages(void *p) { - contigfree(p, PAGE_SIZE<vbus, &bus); HPT_ASSERT(p); - free_pages(p, 0); + free_pages(p); } for (f=vbus_ext->freelist_dma_head; f; f=f->next) { @@ -241,7 +241,7 @@ while ((p=freelist_get_dma(f, &bus))) { if (order) - free_pages(p, order); + free_pages(p); else { /* can't free immediately since other blocks in this page may still be in the list */ if (((HPT_UPTR)p & (PAGE_SIZE-1))==0) @@ -251,7 +251,7 @@ } while ((p = dmapool_get_page((PVBUS)vbus_ext->vbus, &bus))) - free_pages(p, 0); + free_pages(p); } static int hpt_init_vbus(PVBUS_EXT vbus_ext) diff --git a/sys/dev/hptrr/hptrr_osm_bsd.c b/sys/dev/hptrr/hptrr_osm_bsd.c --- a/sys/dev/hptrr/hptrr_osm_bsd.c +++ b/sys/dev/hptrr/hptrr_osm_bsd.c @@ -144,9 +144,9 @@ M_DEVBUF, M_WAITOK, BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); } -static __inline void free_pages(void *p, int order) +static __inline void free_pages(void *p) { - contigfree(p, PAGE_SIZE<vbus, &bus); HPT_ASSERT(p); - free_pages(p, 0); + free_pages(p); } for (f=vbus_ext->freelist_dma_head; f; f=f->next) { @@ -242,7 +242,7 @@ while ((p=freelist_get_dma(f, &bus))) { if (order) - free_pages(p, order); + free_pages(p); else { /* can't free immediately since other blocks in this page may still be in the list */ if (((HPT_UPTR)p & (PAGE_SIZE-1))==0) @@ -252,7 +252,7 @@ } while ((p = dmapool_get_page((PVBUS)vbus_ext->vbus, &bus))) - free_pages(p, 0); + free_pages(p); } static int hpt_init_vbus(PVBUS_EXT vbus_ext) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -5131,7 +5131,7 @@ if (sc->hn_rxbuf != NULL) { if ((sc->hn_flags & HN_FLAG_RXBUF_REF) == 0) - contigfree(sc->hn_rxbuf, HN_RXBUF_SIZE, M_DEVBUF); + free(sc->hn_rxbuf, M_DEVBUF); else device_printf(sc->hn_dev, "RXBUF is referenced\n"); sc->hn_rxbuf = NULL; @@ -5146,8 +5146,7 @@ if (rxr->hn_br == NULL) continue; if ((rxr->hn_rx_flags & HN_RX_FLAG_BR_REF) == 0) { - contigfree(rxr->hn_br, HN_TXBR_SIZE + HN_RXBR_SIZE, - M_DEVBUF); + free(rxr->hn_br, M_DEVBUF); } else { device_printf(sc->hn_dev, "%dth channel bufring is referenced", i); @@ -5649,7 +5648,7 @@ if (sc->hn_chim != NULL) { if ((sc->hn_flags & HN_FLAG_CHIM_REF) == 0) { - contigfree(sc->hn_chim, HN_CHIM_SIZE, M_DEVBUF); + free(sc->hn_chim, M_DEVBUF); } else { device_printf(sc->hn_dev, "chimney sending buffer is referenced"); diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -900,29 +900,27 @@ int cpu; if (sc->vmbus_evtflags != NULL) { - contigfree(sc->vmbus_evtflags, PAGE_SIZE, M_DEVBUF); + free(sc->vmbus_evtflags, M_DEVBUF); sc->vmbus_evtflags = NULL; sc->vmbus_rx_evtflags = NULL; sc->vmbus_tx_evtflags = NULL; } if (sc->vmbus_mnf1 != NULL) { - contigfree(sc->vmbus_mnf1, PAGE_SIZE, M_DEVBUF); + free(sc->vmbus_mnf1, M_DEVBUF); sc->vmbus_mnf1 = NULL; } if (sc->vmbus_mnf2 != NULL) { - contigfree(sc->vmbus_mnf2, sizeof(struct vmbus_mnf), M_DEVBUF); + free(sc->vmbus_mnf2, M_DEVBUF); sc->vmbus_mnf2 = NULL; } CPU_FOREACH(cpu) { if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) { - contigfree(VMBUS_PCPU_GET(sc, message, cpu), PAGE_SIZE, - M_DEVBUF); + free(VMBUS_PCPU_GET(sc, message, cpu), M_DEVBUF); VMBUS_PCPU_GET(sc, message, cpu) = NULL; } if (VMBUS_PCPU_GET(sc, event_flags, cpu) != NULL) { - contigfree(VMBUS_PCPU_GET(sc, event_flags, cpu), - PAGE_SIZE, M_DEVBUF); + free(VMBUS_PCPU_GET(sc, event_flags, cpu), M_DEVBUF); VMBUS_PCPU_GET(sc, event_flags, cpu) = NULL; } } @@ -1423,7 +1421,7 @@ void **hv_cpu_mem; hv_cpu_mem = VMBUS_PCPU_PTR(sc, cpu_mem, cpu); if(*hv_cpu_mem != NULL) { - contigfree(*hv_cpu_mem, PAGE_SIZE, M_DEVBUF); + free(*hv_cpu_mem, M_DEVBUF); *hv_cpu_mem = NULL; } } diff --git a/sys/dev/hyperv/vmbus/vmbus_chan.c b/sys/dev/hyperv/vmbus/vmbus_chan.c --- a/sys/dev/hyperv/vmbus/vmbus_chan.c +++ b/sys/dev/hyperv/vmbus/vmbus_chan.c @@ -341,8 +341,7 @@ * Allocate the TX+RX bufrings. */ KASSERT(chan->ch_bufring == NULL, ("bufrings are allocated")); - chan->ch_bufring_size = txbr_size + rxbr_size; - chan->ch_bufring = contigmalloc(chan->ch_bufring_size, M_DEVBUF, + chan->ch_bufring = contigmalloc(txbr_size + rxbr_size, M_DEVBUF, M_WAITOK | M_ZERO, 0ul, ~0ul, PAGE_SIZE, 0); if (chan->ch_bufring == NULL) { vmbus_chan_printf(chan, "bufring allocation failed\n"); @@ -368,8 +367,7 @@ "leak %d bytes memory\n", chan->ch_id, txbr_size + rxbr_size); } else { - contigfree(chan->ch_bufring, chan->ch_bufring_size, - M_DEVBUF); + free(chan->ch_bufring, M_DEVBUF); } chan->ch_bufring = NULL; } @@ -939,7 +937,7 @@ * Destroy the TX+RX bufrings. */ if (chan->ch_bufring != NULL) { - contigfree(chan->ch_bufring, chan->ch_bufring_size, M_DEVBUF); + free(chan->ch_bufring, M_DEVBUF); chan->ch_bufring = NULL; } return (error); @@ -1679,7 +1677,7 @@ KASSERT(chan->ch_poll_intvl == 0, ("chan%u: polling is activated", chan->ch_id)); - contigfree(chan->ch_monprm, sizeof(struct hyperv_mon_param), M_DEVBUF); + free(chan->ch_monprm, M_DEVBUF); mtx_destroy(&chan->ch_subchan_lock); sx_destroy(&chan->ch_orphan_lock); vmbus_rxbr_deinit(&chan->ch_rxbr); diff --git a/sys/dev/hyperv/vmbus/vmbus_chanvar.h b/sys/dev/hyperv/vmbus/vmbus_chanvar.h --- a/sys/dev/hyperv/vmbus/vmbus_chanvar.h +++ b/sys/dev/hyperv/vmbus/vmbus_chanvar.h @@ -123,7 +123,6 @@ struct vmbus_channel *ch_prichan; /* owner primary chan */ void *ch_bufring; /* TX+RX bufrings */ - size_t ch_bufring_size; uint32_t ch_bufring_gpadl; struct task ch_attach_task; /* run in ch_mgmt_tq */ diff --git a/sys/dev/hyperv/vmbus/vmbus_xact.c b/sys/dev/hyperv/vmbus/vmbus_xact.c --- a/sys/dev/hyperv/vmbus/vmbus_xact.c +++ b/sys/dev/hyperv/vmbus/vmbus_xact.c @@ -104,7 +104,7 @@ vmbus_xact_free(struct vmbus_xact *xact) { - contigfree(xact->x_req, xact->x_ctx->xc_req_size, M_DEVBUF); + free(xact->x_req, M_DEVBUF); free(xact->x_resp0, M_DEVBUF); if (xact->x_priv != NULL) free(xact->x_priv, M_DEVBUF); diff --git a/sys/dev/ioat/ioat_test.c b/sys/dev/ioat/ioat_test.c --- a/sys/dev/ioat/ioat_test.c +++ b/sys/dev/ioat/ioat_test.c @@ -82,17 +82,11 @@ static void ioat_test_transaction_destroy(struct test_transaction *tx) { - struct ioat_test *test; int i; - test = tx->test; - for (i = 0; i < IOAT_MAX_BUFS; i++) { if (tx->buf[i] != NULL) { - if (test->testkind == IOAT_TEST_DMA_8K) - free(tx->buf[i], M_IOAT_TEST); - else - contigfree(tx->buf[i], tx->length, M_IOAT_TEST); + free(tx->buf[i], M_IOAT_TEST); tx->buf[i] = NULL; } } diff --git a/sys/dev/isci/isci.c b/sys/dev/isci/isci.c --- a/sys/dev/isci/isci.c +++ b/sys/dev/isci/isci.c @@ -235,7 +235,7 @@ sci_pool_get(controller->unmap_buffer_pool, unmap_buffer); if (unmap_buffer == NULL) break; - contigfree(unmap_buffer, PAGE_SIZE, M_ISCI); + free(unmap_buffer, M_ISCI); } } diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c --- a/sys/dev/lge/if_lge.c +++ b/sys/dev/lge/if_lge.c @@ -555,8 +555,7 @@ fail: lge_free_jumbo_mem(sc); if (sc->lge_ldata) - contigfree(sc->lge_ldata, - sizeof(struct lge_list_data), M_DEVBUF); + free(sc->lge_ldata, M_DEVBUF); if (ifp) if_free(ifp); if (sc->lge_irq) @@ -590,7 +589,7 @@ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->lge_irq); bus_release_resource(dev, LGE_RES, LGE_RID, sc->lge_res); - contigfree(sc->lge_ldata, sizeof(struct lge_list_data), M_DEVBUF); + free(sc->lge_ldata, M_DEVBUF); if_free(ifp); lge_free_jumbo_mem(sc); mtx_destroy(&sc->lge_mtx); @@ -784,7 +783,7 @@ free(entry, M_DEVBUF); } - contigfree(sc->lge_cdata.lge_jumbo_buf, LGE_JMEM, M_DEVBUF); + free(sc->lge_cdata.lge_jumbo_buf, M_DEVBUF); return; } diff --git a/sys/dev/netmap/if_ptnet.c b/sys/dev/netmap/if_ptnet.c --- a/sys/dev/netmap/if_ptnet.c +++ b/sys/dev/netmap/if_ptnet.c @@ -540,7 +540,7 @@ ptnet_irqs_fini(sc); if (sc->csb_gh) { - contigfree(sc->csb_gh, 2*PAGE_SIZE, M_DEVBUF); + free(sc->csb_gh, M_DEVBUF); sc->csb_gh = NULL; sc->csb_hg = NULL; } diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c --- a/sys/dev/netmap/netmap_mem2.c +++ b/sys/dev/netmap/netmap_mem2.c @@ -1284,7 +1284,7 @@ * in the lut. */ for (i = 0; i < p->objtotal; i += p->_clustentries) { - contigfree(p->lut[i].vaddr, p->_clustsize, M_NETMAP); + free(p->lut[i].vaddr, M_NETMAP); } nm_free_lut(p->lut, p->objtotal); } @@ -1402,7 +1402,6 @@ netmap_finalize_obj_allocator(struct netmap_obj_pool *p) { int i; /* must be signed */ - size_t n; if (p->lut) { /* if the lut is already there we assume that also all the @@ -1430,7 +1429,6 @@ * Allocate clusters, init pointers */ - n = p->_clustsize; for (i = 0; i < (int)p->objtotal;) { int lim = i + p->_clustentries; char *clust; @@ -1442,7 +1440,7 @@ * can live with standard malloc, because the hardware will not * access the pages directly. */ - clust = contigmalloc(n, M_NETMAP, M_NOWAIT | M_ZERO, + clust = contigmalloc(p->_clustsize, M_NETMAP, M_NOWAIT | M_ZERO, (size_t)0, -1UL, PAGE_SIZE, 0); if (clust == NULL) { /* @@ -1456,8 +1454,7 @@ lim = i / 2; for (i--; i >= lim; i--) { if (i % p->_clustentries == 0 && p->lut[i].vaddr) - contigfree(p->lut[i].vaddr, - n, M_NETMAP); + free(p->lut[i].vaddr, M_NETMAP); p->lut[i].vaddr = NULL; } out: diff --git a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c --- a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c +++ b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c @@ -6478,7 +6478,6 @@ pCard->pPortalData = NULL; AGTIAPI_PRINTK("agtiapi_ReleaseHBA: PortalData released\n"); } - //calls contigfree() or free() agtiapi_MemFree(pCardInfo); AGTIAPI_PRINTK("agtiapi_ReleaseHBA: low level resource released\n"); diff --git a/sys/dev/pst/pst-iop.c b/sys/dev/pst/pst-iop.c --- a/sys/dev/pst/pst-iop.c +++ b/sys/dev/pst/pst-iop.c @@ -136,7 +136,7 @@ ident->vendor, ident->product); printf("pstiop: description=<%.16s> revision=<%.8s>\n", ident->description, ident->revision); - contigfree(reply, PAGE_SIZE, M_PSTIOP); + free(reply, M_PSTIOP); } #endif @@ -317,18 +317,18 @@ msg->sgl.phys_addr[0] = vtophys(reply); if (iop_queue_wait_msg(sc, mfa, (struct i2o_basic_message *)msg)) { - contigfree(reply, ALLOCSIZE, M_PSTIOP); + free(reply, M_PSTIOP); return 0; } if (!(sc->lct = malloc(reply->table_size * sizeof(struct i2o_lct_entry), M_PSTIOP, M_NOWAIT | M_ZERO))) { - contigfree(reply, ALLOCSIZE, M_PSTIOP); + free(reply, M_PSTIOP); return 0; } bcopy(&reply->entry[0], sc->lct, reply->table_size * sizeof(struct i2o_lct_entry)); sc->lct_count = reply->table_size; - contigfree(reply, ALLOCSIZE, M_PSTIOP); + free(reply, M_PSTIOP); return 1; } @@ -374,10 +374,10 @@ if (iop_queue_wait_msg(sc, mfa, (struct i2o_basic_message *)msg) || reply->error_info_size) { - contigfree(reply, PAGE_SIZE, M_PSTIOP); + free(reply, M_PSTIOP); reply = NULL; } - contigfree(param, PAGE_SIZE, M_PSTIOP); + free(param, M_PSTIOP); return reply; } diff --git a/sys/dev/pst/pst-raid.c b/sys/dev/pst/pst-raid.c --- a/sys/dev/pst/pst-raid.c +++ b/sys/dev/pst/pst-raid.c @@ -126,11 +126,11 @@ if (!(psc->info = (struct i2o_bsa_device *) malloc(sizeof(struct i2o_bsa_device), M_PSTRAID, M_NOWAIT))) { - contigfree(reply, PAGE_SIZE, M_PSTIOP); + free(reply, M_PSTIOP); return ENOMEM; } bcopy(reply->result, psc->info, sizeof(struct i2o_bsa_device)); - contigfree(reply, PAGE_SIZE, M_PSTIOP); + free(reply, M_PSTIOP); if (!(reply = iop_get_util_params(psc->iop, psc->lct->local_tid, I2O_PARAMS_OPERATION_FIELD_GET, @@ -148,7 +148,7 @@ bpack(ident->vendor, ident->vendor, 16); bpack(ident->product, ident->product, 16); sprintf(name, "%s %s", ident->vendor, ident->product); - contigfree(reply, PAGE_SIZE, M_PSTIOP); + free(reply, M_PSTIOP); bioq_init(&psc->queue); diff --git a/sys/dev/qat/qat/qat_ocf.c b/sys/dev/qat/qat/qat_ocf.c --- a/sys/dev/qat/qat/qat_ocf.c +++ b/sys/dev/qat/qat/qat_ocf.c @@ -544,7 +544,7 @@ fail: /* Release resources if any */ if (sessionCtx) - contigfree(sessionCtx, sessionCtxSize, M_QAT_OCF); + free(sessionCtx, M_QAT_OCF); return status; } @@ -610,9 +610,7 @@ } explicit_bzero(qat_session->sessionCtx, qat_session->sessionCtxSize); - contigfree(qat_session->sessionCtx, - qat_session->sessionCtxSize, - M_QAT_OCF); + free(qat_session->sessionCtx, M_QAT_OCF); qat_session->sessionCtx = NULL; qat_session->sessionCtxSize = 0; diff --git a/sys/dev/qat/qat_api/qat_utils/src/QatUtilsServices.c b/sys/dev/qat/qat_api/qat_utils/src/QatUtilsServices.c --- a/sys/dev/qat/qat_api/qat_utils/src/QatUtilsServices.c +++ b/sys/dev/qat/qat_api/qat_utils/src/QatUtilsServices.c @@ -91,7 +91,7 @@ "QatUtilsMemAlignedFree: Detected corrupted data: memory leak!\n"); return; } - contigfree(memInfo->mAllocMemPtr, memInfo->mSize, M_QAT); + free(memInfo->mAllocMemPtr, M_QAT); } CpaStatus diff --git a/sys/dev/virtio/gpu/virtio_gpu.c b/sys/dev/virtio/gpu/virtio_gpu.c --- a/sys/dev/virtio/gpu/virtio_gpu.c +++ b/sys/dev/virtio/gpu/virtio_gpu.c @@ -371,8 +371,8 @@ vt_deallocate(&vtgpu_fb_driver, &sc->vtgpu_fb_info); if (sc->vtgpu_fb_info.fb_vbase != 0) { MPASS(sc->vtgpu_fb_info.fb_size != 0); - contigfree((void *)sc->vtgpu_fb_info.fb_vbase, - sc->vtgpu_fb_info.fb_size, M_DEVBUF); + free((void *)sc->vtgpu_fb_info.fb_vbase, + M_DEVBUF); } /* TODO: Tell the host we are detaching */ diff --git a/sys/dev/virtio/virtqueue.c b/sys/dev/virtio/virtqueue.c --- a/sys/dev/virtio/virtqueue.c +++ b/sys/dev/virtio/virtqueue.c @@ -360,7 +360,7 @@ virtqueue_free_indirect(vq); if (vq->vq_ring_mem != NULL) { - contigfree(vq->vq_ring_mem, vq->vq_ring_size, M_DEVBUF); + free(vq->vq_ring_mem, M_DEVBUF); vq->vq_ring_size = 0; vq->vq_ring_mem = NULL; } diff --git a/sys/dev/vmware/vmci/vmci_kernel_if.c b/sys/dev/vmware/vmci/vmci_kernel_if.c --- a/sys/dev/vmware/vmci/vmci_kernel_if.c +++ b/sys/dev/vmware/vmci/vmci_kernel_if.c @@ -236,10 +236,10 @@ */ void -vmci_free_kernel_mem(void *ptr, size_t size) +vmci_free_kernel_mem(void *ptr, size_t size __unused) { - contigfree(ptr, size, M_DEVBUF); + free(ptr, M_DEVBUF); } /* diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c --- a/sys/dev/xen/blkfront/blkfront.c +++ b/sys/dev/xen/blkfront/blkfront.c @@ -1064,9 +1064,7 @@ gnttab_end_foreign_access_references( sc->xbd_max_request_indirectpages, &cm->cm_indirectionrefs[0]); - contigfree(cm->cm_indirectionpages, PAGE_SIZE * - sc->xbd_max_request_indirectpages, - M_XENBLOCKFRONT); + free(cm->cm_indirectionpages, M_XENBLOCKFRONT); cm->cm_indirectionpages = NULL; } @@ -1373,9 +1371,7 @@ break; } if (j < sc->xbd_max_request_indirectpages) { - contigfree(indirectpages, - PAGE_SIZE * sc->xbd_max_request_indirectpages, - M_XENBLOCKFRONT); + free(indirectpages, M_XENBLOCKFRONT); break; } cm->cm_indirectionpages = indirectpages; diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c --- a/sys/i386/acpica/acpi_wakeup.c +++ b/sys/i386/acpica/acpi_wakeup.c @@ -349,8 +349,7 @@ freepages: for (i = 0; i < ACPI_WAKEPAGES; i++) - if (wakepages[i] != NULL) - contigfree(wakepages[i], PAGE_SIZE, M_DEVBUF); + free(wakepages[i], M_DEVBUF); return (NULL); } diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -509,21 +509,15 @@ } return (ret); } +#undef IS_CONTIG_MALLOC +#undef CONTIG_MALLOC_SLAB -/* - * contigfree (deprecated). - * - * Free a block of memory allocated by contigmalloc. - * - * This routine may not block. - */ +/* contigfree(9) is deprecated. */ void contigfree(void *addr, unsigned long size __unused, struct malloc_type *type) { free(addr, type); } -#undef IS_CONTIG_MALLOC -#undef CONTIG_MALLOC_SLAB #ifdef MALLOC_DEBUG static int diff --git a/sys/powerpc/powernv/opal_nvram.c b/sys/powerpc/powernv/opal_nvram.c --- a/sys/powerpc/powernv/opal_nvram.c +++ b/sys/powerpc/powernv/opal_nvram.c @@ -167,8 +167,7 @@ if (sc->sc_cdev != NULL) destroy_dev(sc->sc_cdev); - if (sc->sc_buf != NULL) - contigfree(sc->sc_buf, NVRAM_BUFSIZE, M_DEVBUF); + free(sc->sc_buf, M_DEVBUF); mtx_destroy(&sc->sc_mtx); diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -455,7 +455,7 @@ /* * Free a piece of memory and it's allociated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. + * via bus_dmamem_alloc. */ void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) diff --git a/sys/riscv/include/bus_dma.h b/sys/riscv/include/bus_dma.h --- a/sys/riscv/include/bus_dma.h +++ b/sys/riscv/include/bus_dma.h @@ -50,7 +50,7 @@ /* * Free a piece of memory and it's allociated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. + * via bus_dmamem_alloc. */ static inline void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) diff --git a/sys/riscv/riscv/busdma_bounce.c b/sys/riscv/riscv/busdma_bounce.c --- a/sys/riscv/riscv/busdma_bounce.c +++ b/sys/riscv/riscv/busdma_bounce.c @@ -460,7 +460,7 @@ /* * Free a piece of memory and it's allociated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. + * via bus_dmamem_alloc. */ static void bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -177,7 +177,8 @@ */ typedef void malloc_type_list_func_t(struct malloc_type *, void *); -void contigfree(void *addr, unsigned long size, struct malloc_type *type); +/* contigfree(9) is deprecated. */ +void contigfree(void *addr, unsigned long, struct malloc_type *type); void *contigmalloc(unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, vm_paddr_t boundary) __malloc_like __result_use_check diff --git a/sys/x86/include/bus_dma.h b/sys/x86/include/bus_dma.h --- a/sys/x86/include/bus_dma.h +++ b/sys/x86/include/bus_dma.h @@ -88,7 +88,7 @@ /* * Free a piece of memory and it's allociated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. + * via bus_dmamem_alloc. */ static inline void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) diff --git a/sys/x86/isa/isa_dma.c b/sys/x86/isa/isa_dma.c --- a/sys/x86/isa/isa_dma.c +++ b/sys/x86/isa/isa_dma.c @@ -84,7 +84,6 @@ isa_dma_init(int chan, u_int bouncebufsize, int flag) { void *buf; - int contig; #ifdef DIAGNOSTIC if (chan & ~VALID_DMA_MASK) @@ -98,13 +97,11 @@ free(buf, M_DEVBUF); buf = NULL; } - contig = 0; } if (buf == NULL) { buf = contigmalloc(bouncebufsize, M_DEVBUF, flag, 0ul, 0xfffffful, 1ul, chan & 4 ? 0x20000ul : 0x10000ul); - contig = 1; } if (buf == NULL) @@ -120,10 +117,7 @@ * XXX: the same driver. */ if (dma_bouncebuf[chan] != NULL) { - if (contig) - contigfree(buf, bouncebufsize, M_DEVBUF); - else - free(buf, M_DEVBUF); + free(buf, M_DEVBUF); mtx_unlock(&isa_dma_lock); return (0); } diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -476,7 +476,7 @@ /* * Free a piece of memory and its associated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. + * via bus_dmamem_alloc. */ static void bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) diff --git a/tools/test/stress2/misc/contigmalloc.sh b/tools/test/stress2/misc/contigmalloc.sh --- a/tools/test/stress2/misc/contigmalloc.sh +++ b/tools/test/stress2/misc/contigmalloc.sh @@ -26,7 +26,7 @@ # SUCH DAMAGE. # -# contigmalloc(9) / contigfree(9) test scenario. +# contigmalloc(9) / free(9) test scenario. # malloc() a random number of buffers with random size and then free them. # A malloc pattern might look like this: @@ -116,7 +116,7 @@ if (p[i] != NULL) { res = syscall(no, TFREE, &p[i], &size[i]); #if defined(TEST) - fprintf(stderr, "contigfree(%lu pages)\n", + fprintf(stderr, "free(%lu pages)\n", size[i] / ps); #endif p[i] = NULL; @@ -197,10 +197,8 @@ switch (uap->a_op) { case TFREE: error = copyin(uap->a_ptr, &p, sizeof(p)); - if (error == 0) { - if (p != NULL) - contigfree(p, size, M_TEMP); - } + if (error == 0) + free(p, M_TEMP); return (error); case TALLOC: diff --git a/tools/test/stress2/misc/contigmalloc2.sh b/tools/test/stress2/misc/contigmalloc2.sh --- a/tools/test/stress2/misc/contigmalloc2.sh +++ b/tools/test/stress2/misc/contigmalloc2.sh @@ -26,7 +26,7 @@ # SUCH DAMAGE. # -# contigmalloc(9) / contigfree(9) test scenario. +# contigmalloc(9) / free(9) test scenario. # Regression test for allocations >= 2 GiB. # "panic: vm_page_insert_after: mpred doesn't precede pindex" seen. # Fixed by r284207. @@ -87,8 +87,7 @@ #endif res = syscall(no, TFREE, &p, &size); #if defined(TEST) - fprintf(stderr, "contigfree(%lu pages)\n", - size); + fprintf(stderr, "free(%lu pages)\n", size); #endif } size /= 2; @@ -165,10 +164,8 @@ switch (uap->a_op) { case TFREE: error = copyin(uap->a_ptr, &p, sizeof(p)); - if (error == 0) { - if (p != NULL) - contigfree(p, size, M_TEMP); - } + if (error == 0) + free(p, M_TEMP); return (error); case TALLOC: diff --git a/tools/test/stress2/misc/contigmalloc3.sh b/tools/test/stress2/misc/contigmalloc3.sh --- a/tools/test/stress2/misc/contigmalloc3.sh +++ b/tools/test/stress2/misc/contigmalloc3.sh @@ -26,7 +26,7 @@ # SUCH DAMAGE. # -# contigmalloc(9) / contigfree(9) test scenario. +# contigmalloc(9) / free(9) test scenario. # Test allocation with 1GB # "panic: Bad link elm 0x6766fbc next->prev != elm" seen: @@ -91,7 +91,7 @@ res = syscall(no, TFREE, &cp, &size); #if defined(TEST) - fprintf(stderr, "contigfree(%lu pages) %luMB\n", + fprintf(stderr, "free(%lu pages) %luMB\n", size / ps, size / 1024 / 1024); #endif } @@ -166,10 +166,8 @@ switch (uap->a_op) { case TFREE: error = copyin(uap->a_ptr, &p, sizeof(p)); - if (error == 0) { - if (p != NULL) - contigfree(p, size, M_TEMP); - } + if (error == 0) + free(p, M_TEMP); return (error); case TALLOC: