DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: "Xia, Chenbo" <chenbo.xia@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>
Subject: Re: [dpdk-dev] [PATCH v6 7/7] vhost: convert inflight data to DPDK allocation API
Date: Tue, 29 Jun 2021 16:36:34 +0200	[thread overview]
Message-ID: <7e9d43aa-5f12-2e07-b9cf-b3f9169c48fa@redhat.com> (raw)
In-Reply-To: <MN2PR11MB40630470269CDBA1402070239C069@MN2PR11MB4063.namprd11.prod.outlook.com>

Hi Chenbo,

On 6/25/21 9:26 AM, Xia, Chenbo wrote:
> Hi Maxime,
> 
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Sent: Friday, June 18, 2021 10:04 PM
>> To: dev@dpdk.org; david.marchand@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
>> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
>> 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 <maxime.coquelin@redhat.com>
>> ---
>>  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
> 


      reply	other threads:[~2021-06-29 14:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 14:03 [dpdk-dev] [PATCH v6 0/7] vhost: Fix and improve NUMA reallocation Maxime Coquelin
2021-06-18 14:03 ` [dpdk-dev] [PATCH v6 1/7] vhost: fix missing memory table NUMA realloc Maxime Coquelin
2021-06-25  2:26   ` Xia, Chenbo
2021-06-18 14:03 ` [dpdk-dev] [PATCH v6 2/7] vhost: fix missing guest pages " Maxime Coquelin
2021-06-25  2:26   ` Xia, Chenbo
2021-06-18 14:03 ` [dpdk-dev] [PATCH v6 3/7] vhost: fix missing cache logging " Maxime Coquelin
2021-06-25  2:50   ` Xia, Chenbo
2021-06-29 14:38     ` Maxime Coquelin
2021-06-30  8:50       ` Xia, Chenbo
2021-06-18 14:03 ` [dpdk-dev] [PATCH v6 4/7] vhost: fix NUMA reallocation with multiqueue Maxime Coquelin
2021-06-25  2:56   ` Xia, Chenbo
2021-06-25 11:37     ` Xia, Chenbo
2021-06-29 14:35       ` Maxime Coquelin
2021-06-18 14:03 ` [dpdk-dev] [PATCH v6 5/7] vhost: improve NUMA reallocation Maxime Coquelin
2021-06-25  7:26   ` Xia, Chenbo
2021-06-18 14:03 ` [dpdk-dev] [PATCH v6 6/7] vhost: allocate all data on same node as virtqueue Maxime Coquelin
2021-06-25  7:26   ` Xia, Chenbo
2021-06-18 14:03 ` [dpdk-dev] [PATCH v6 7/7] vhost: convert inflight data to DPDK allocation API Maxime Coquelin
2021-06-25  7:26   ` Xia, Chenbo
2021-06-29 14:36     ` Maxime Coquelin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e9d43aa-5f12-2e07-b9cf-b3f9169c48fa@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).