From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9307AA0A0C; Tue, 29 Jun 2021 16:36:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7F710411AE; Tue, 29 Jun 2021 16:36:44 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 60E7B4117E for ; Tue, 29 Jun 2021 16:36:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624977402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZA2/OryDomsV/Il5nkGtmsFwRa+E2UAw1WfXzX9AHqU=; b=AZ9JkQQ0vVOvhtJFaHGM9xpRGDcHGb4DmZyi12yg7wr7k0zfS2DMj4zcWlaGk2v2t7vOmf joq7kMSdHFHuXED7LPwnsw5MayKdAkdDPr39tk138I+D8EyuwqCCENvGc59WEw9QYvogTs nVVSp8p6OFbHXMQj9YAvlZg8ozMNO9s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-504-k8sDntBkPAmAr-BUwzwZ4w-1; Tue, 29 Jun 2021 10:36:41 -0400 X-MC-Unique: k8sDntBkPAmAr-BUwzwZ4w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D8B5922221; Tue, 29 Jun 2021 14:36:40 +0000 (UTC) Received: from [10.36.110.32] (unknown [10.36.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B293A5C1D1; Tue, 29 Jun 2021 14:36:35 +0000 (UTC) To: "Xia, Chenbo" , "dev@dpdk.org" , "david.marchand@redhat.com" References: <20210618140357.255995-1-maxime.coquelin@redhat.com> <20210618140357.255995-8-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: <7e9d43aa-5f12-2e07-b9cf-b3f9169c48fa@redhat.com> Date: Tue, 29 Jun 2021 16:36:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 7/7] vhost: convert inflight data to DPDK allocation API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Chenbo, On 6/25/21 9:26 AM, Xia, Chenbo wrote: > Hi Maxime, > >> -----Original Message----- >> From: Maxime Coquelin >> Sent: Friday, June 18, 2021 10:04 PM >> To: dev@dpdk.org; david.marchand@redhat.com; Xia, Chenbo >> Cc: Maxime Coquelin >> Subject: [PATCH v6 7/7] vhost: convert inflight data to DPDK allocation API >> >> Inflight metadata are allocated using glibc's calloc. >> This patch converts them to rte_zmalloc_socket to take >> care of the NUMA affinity. >> >> Signed-off-by: Maxime Coquelin >> --- >> lib/vhost/vhost.c | 4 +-- >> lib/vhost/vhost_user.c | 67 +++++++++++++++++++++++++++++++++++------- >> 2 files changed, 58 insertions(+), 13 deletions(-) >> >> diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c >> index 0000cd3297..53a470f547 100644 >> --- a/lib/vhost/vhost.c >> +++ b/lib/vhost/vhost.c > > [...] > >> @@ -1779,15 +1820,17 @@ vhost_check_queue_inflights_split(struct virtio_net >> *dev, >> vq->last_avail_idx += resubmit_num; >> >> if (resubmit_num) { >> - resubmit = calloc(1, sizeof(struct rte_vhost_resubmit_info)); >> + resubmit = rte_zmalloc_socket("resubmit", sizeof(struct >> rte_vhost_resubmit_info), >> + 0, vq->numa_node); >> if (!resubmit) { >> VHOST_LOG_CONFIG(ERR, >> "failed to allocate memory for resubmit info.\n"); >> return RTE_VHOST_MSG_RESULT_ERR; >> } >> >> - resubmit->resubmit_list = calloc(resubmit_num, >> - sizeof(struct rte_vhost_resubmit_desc)); >> + resubmit->resubmit_list = rte_zmalloc_socket("resubmit_list", >> + resubmit_num * sizeof(struct rte_vhost_resubmit_desc), >> + 0, vq->numa_node); >> if (!resubmit->resubmit_list) { >> VHOST_LOG_CONFIG(ERR, >> "failed to allocate memory for inflight desc.\n"); >> @@ -1873,15 +1916,17 @@ vhost_check_queue_inflights_packed(struct virtio_net >> *dev, >> } >> >> if (resubmit_num) { >> - resubmit = calloc(1, sizeof(struct rte_vhost_resubmit_info)); >> + resubmit = rte_zmalloc_socket("resubmit", sizeof(struct >> rte_vhost_resubmit_info), >> + 0, vq->numa_node); > > There are still two 'free(resubmit)' in vhost_check_queue_inflights_split and > vhost_check_queue_inflights_packed, which should be replaced with rte_free() Good catch, I'll fix this in next revision. Thanks, Maxime > Thanks, > Chenbo > >> if (resubmit == NULL) { >> VHOST_LOG_CONFIG(ERR, >> "failed to allocate memory for resubmit info.\n"); >> return RTE_VHOST_MSG_RESULT_ERR; >> } >> >> - resubmit->resubmit_list = calloc(resubmit_num, >> - sizeof(struct rte_vhost_resubmit_desc)); >> + resubmit->resubmit_list = rte_zmalloc_socket("resubmit_list", >> + resubmit_num * sizeof(struct rte_vhost_resubmit_desc), >> + 0, vq->numa_node); >> if (resubmit->resubmit_list == NULL) { >> VHOST_LOG_CONFIG(ERR, >> "failed to allocate memory for resubmit desc.\n"); >> -- >> 2.31.1 >