From ac2fffa4b74cd83963f0d462c379c7f50eeabf20 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sun, 21 Jan 2018 15:42:36 +0000 Subject: Revert r327828, r327949, r327953, r328016-r328026, r328041: Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 --- sys/dev/vmware/vmxnet3/if_vmx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sys/dev/vmware') diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c index 837715a05f86..a83e2de31661 100644 --- a/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/sys/dev/vmware/vmxnet3/if_vmx.c @@ -959,7 +959,7 @@ vmxnet3_init_rxq(struct vmxnet3_softc *sc, int q) rxr = &rxq->vxrxq_cmd_ring[i]; rxr->vxrxr_rid = i; rxr->vxrxr_ndesc = sc->vmx_nrxdescs; - rxr->vxrxr_rxbuf = mallocarray(rxr->vxrxr_ndesc, + rxr->vxrxr_rxbuf = malloc(rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxbuf), M_DEVBUF, M_NOWAIT | M_ZERO); if (rxr->vxrxr_rxbuf == NULL) return (ENOMEM); @@ -987,7 +987,7 @@ vmxnet3_init_txq(struct vmxnet3_softc *sc, int q) txq->vxtxq_id = q; txr->vxtxr_ndesc = sc->vmx_ntxdescs; - txr->vxtxr_txbuf = mallocarray(txr->vxtxr_ndesc, + txr->vxtxr_txbuf = malloc(txr->vxtxr_ndesc * sizeof(struct vmxnet3_txbuf), M_DEVBUF, M_NOWAIT | M_ZERO); if (txr->vxtxr_txbuf == NULL) return (ENOMEM); @@ -1023,10 +1023,10 @@ vmxnet3_alloc_rxtx_queues(struct vmxnet3_softc *sc) sc->vmx_max_ntxqueues = 1; } - sc->vmx_rxq = mallocarray(sc->vmx_max_nrxqueues, - sizeof(struct vmxnet3_rxqueue), M_DEVBUF, M_NOWAIT | M_ZERO); - sc->vmx_txq = mallocarray(sc->vmx_max_ntxqueues, - sizeof(struct vmxnet3_txqueue), M_DEVBUF, M_NOWAIT | M_ZERO); + sc->vmx_rxq = malloc(sizeof(struct vmxnet3_rxqueue) * + sc->vmx_max_nrxqueues, M_DEVBUF, M_NOWAIT | M_ZERO); + sc->vmx_txq = malloc(sizeof(struct vmxnet3_txqueue) * + sc->vmx_max_ntxqueues, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->vmx_rxq == NULL || sc->vmx_txq == NULL) return (ENOMEM); -- cgit v1.3