From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 742694C92; Mon, 10 Sep 2018 15:38:29 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0627D40216ED; Mon, 10 Sep 2018 13:38:29 +0000 (UTC) Received: from [10.36.112.46] (ovpn-112-46.ams2.redhat.com [10.36.112.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA1042027EB7; Mon, 10 Sep 2018 13:38:26 +0000 (UTC) To: Ilya Maximets , dev@dpdk.org Cc: Tiwei Bie , Zhihong Wang , Junjie Chen , stable@dpdk.org References: <20180815145439.2513-1-i.maximets@samsung.com> From: Maxime Coquelin Message-ID: <565a2e47-01ef-dc34-882f-40c0719ac68f@redhat.com> Date: Mon, 10 Sep 2018 15:38:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180815145439.2513-1-i.maximets@samsung.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 10 Sep 2018 13:38:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 10 Sep 2018 13:38:29 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:'' Subject: Re: [dpdk-dev] [PATCH] vhost: fix zmbufs array leak after NUMA realloc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Sep 2018 13:38:29 -0000 On 08/15/2018 04:54 PM, Ilya Maximets wrote: > 'numa_realloc()' allocates 'zmbufs' even if zero copy mode > is not configured. This leads to memory leak, because array > is freed only for zero copy case. > > Fixes: 2651726defb7 ("vhost: do deep copy while reallocating queue") > CC: stable@dpdk.org > > Signed-off-by: Ilya Maximets > --- > lib/librte_vhost/vhost_user.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c > index a2d4c9ffc..9aa1ce118 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -357,11 +357,13 @@ numa_realloc(struct virtio_net *dev, int index) > memcpy(vq, old_vq, sizeof(*vq)); > TAILQ_INIT(&vq->zmbuf_list); > > - new_zmbuf = rte_malloc_socket(NULL, vq->zmbuf_size * > - sizeof(struct zcopy_mbuf), 0, newnode); > - if (new_zmbuf) { > - rte_free(vq->zmbufs); > - vq->zmbufs = new_zmbuf; > + if (dev->dequeue_zero_copy) { > + new_zmbuf = rte_malloc_socket(NULL, vq->zmbuf_size * > + sizeof(struct zcopy_mbuf), 0, newnode); > + if (new_zmbuf) { > + rte_free(vq->zmbufs); > + vq->zmbufs = new_zmbuf; > + } > } > > if (vq_is_packed(dev)) { > Applied to dpdk-next-virtio/master. Thanks! Maxime