Skip site navigation (1)Skip section navigation (2)



index | | raw e-mail

I believe this is causing a massive memory leak in the devbuf malloc
type.  I can't even get through a build over nfs on a VM without
hitting OOM.  Reverting b5bad6df467cc95bea641afe674c55cd5b9f1510 and
c16c95192f01237a876eb7bc336e3bbda9310171 fixes the leak.  Can you
please fix or revert this?

You can monitor the leak with something like
vmstat -m | grep devbuf

> @@ -1562,13 +1643,43 @@ vtnet_rx_alloc_buf(struct vtnet_softc *sc, int nb=
ufs, struct mbuf **m_tailp)
>                 }
>
>                 m->m_len =3D size;
> +               vthdr =3D (struct vtnet_rx_buffer_header *)m->m_data;
> +
> +               /* Reserve space for header */
> +               m_adj(m, VTNET_RX_BUFFER_HEADER_OFFSET);
> +
>                 /*
>                  * Need to offset the mbuf if the header we're going to a=
dd
>                  * will misalign.
>                  */
> -               if (VTNET_ETHER_ALIGN !=3D 0 && sc->vtnet_hdr_size % 4 =
=3D=3D 0) {
> +               if (VTNET_ETHER_ALIGN !=3D 0 && sc->vtnet_hdr_size % 4 =
=3D=3D 0)
>                         m_adj(m, VTNET_ETHER_ALIGN);
> +
> +               err =3D bus_dmamap_create(sc->vtnet_rx_dmat, 0, &dmap);
> +               if (err) {
> +                       printf("Failed to create dmamap, err :%d\n",
> +                           err);
> +                       m_freem(m);
> +                       return (NULL);
>                 }
> +
> +               nsegs =3D 0;
> +               err =3D bus_dmamap_load_mbuf_sg(sc->vtnet_rx_dmat, dmap, =
m, segs,
> +                   &nsegs, BUS_DMA_NOWAIT);

Where is the bus_dmamap_unload and bus_dmamap_destroy for the rx bufs?

Ryan


home | help