aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mxge
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2018-01-21 15:42:36 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2018-01-21 15:42:36 +0000
commitac2fffa4b74cd83963f0d462c379c7f50eeabf20 (patch)
tree1f8fc635121499d467998c99ece5983a2d563840 /sys/dev/mxge
parente09304d8f33887be9cc37817885061ccbb770d50 (diff)
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
Notes
Notes: svn path=/head/; revision=328218
Diffstat (limited to 'sys/dev/mxge')
-rw-r--r--sys/dev/mxge/if_mxge.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c
index a5d46c721b3c..edd5ff3a972f 100644
--- a/sys/dev/mxge/if_mxge.c
+++ b/sys/dev/mxge/if_mxge.c
@@ -688,7 +688,7 @@ z_alloc(void *nil, u_int items, u_int size)
{
void *ptr;
- ptr = mallocarray(items, size, M_TEMP, M_NOWAIT);
+ ptr = malloc(items * size, M_TEMP, M_NOWAIT);
return ptr;
}
@@ -4390,8 +4390,8 @@ mxge_alloc_slices(mxge_softc_t *sc)
sc->rx_ring_size = cmd.data0;
max_intr_slots = 2 * (sc->rx_ring_size / sizeof (mcp_dma_addr_t));
- sc->ss = mallocarray(sc->num_slices, sizeof(*sc->ss), M_DEVBUF,
- M_NOWAIT | M_ZERO);
+ bytes = sizeof (*sc->ss) * sc->num_slices;
+ sc->ss = malloc(bytes, M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->ss == NULL)
return (ENOMEM);
for (i = 0; i < sc->num_slices; i++) {
@@ -4535,6 +4535,7 @@ abort_with_fw:
static int
mxge_add_msix_irqs(mxge_softc_t *sc)
{
+ size_t bytes;
int count, err, i, rid;
rid = PCIR_BAR(2);
@@ -4562,8 +4563,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc)
err = ENOSPC;
goto abort_with_msix;
}
- sc->msix_irq_res = mallocarray(sc->num_slices,
- sizeof(*sc->msix_irq_res), M_DEVBUF, M_NOWAIT|M_ZERO);
+ bytes = sizeof (*sc->msix_irq_res) * sc->num_slices;
+ sc->msix_irq_res = malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO);
if (sc->msix_irq_res == NULL) {
err = ENOMEM;
goto abort_with_msix;
@@ -4582,8 +4583,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc)
}
}
- sc->msix_ih = mallocarray(sc->num_slices, sizeof(*sc->msix_ih),
- M_DEVBUF, M_NOWAIT|M_ZERO);
+ bytes = sizeof (*sc->msix_ih) * sc->num_slices;
+ sc->msix_ih = malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO);
for (i = 0; i < sc->num_slices; i++) {
err = bus_setup_intr(sc->dev, sc->msix_irq_res[i],