From: David Marchand <david.marchand@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: dev <dev@dpdk.org>, "Xia, Chenbo" <chenbo.xia@intel.com>
Subject: Re: [dpdk-dev] [PATCH v7 7/7] vhost: convert inflight data to DPDK allocation API
Date: Wed, 30 Jun 2021 09:55:57 +0200 [thread overview]
Message-ID: <CAJFAV8xSSKjctj2L0b4yfE+abO6tLt3uqQVz7GRckMCUziQLew@mail.gmail.com> (raw)
In-Reply-To: <20210629161133.79472-8-maxime.coquelin@redhat.com>
On Tue, Jun 29, 2021 at 6:11 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> Inflight metadata are allocated using glibc's calloc.
> This patch converts them to rte_zmalloc_socket to take
> care of the NUMA affinity.
About the title, maybe:
vhost: use DPDK allocations for inflight data
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
[snip]
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index d8ec087dfc..67935c4ccc 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
[snip]
> @@ -1779,19 +1820,21 @@ 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),
Nit: double space.
> + 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");
> - free(resubmit);
> + rte_free(resubmit);
> return RTE_VHOST_MSG_RESULT_ERR;
> }
>
> @@ -1873,19 +1916,21 @@ 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),
Copy/paste detected :-)
Double space.
Having a single allocator between split and packed implems would avoid
this, but it might not be that easy and this is out of the scope for
this patch.
> + 0, vq->numa_node);
> 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");
> - free(resubmit);
> + rte_free(resubmit);
> return RTE_VHOST_MSG_RESULT_ERR;
> }
>
> --
> 2.31.1
>
--
David Marchand
next prev parent reply other threads:[~2021-06-30 7:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-29 16:11 [dpdk-dev] [PATCH v7 0/7] vhost: Fix and improve NUMA reallocation Maxime Coquelin
2021-06-29 16:11 ` [dpdk-dev] [PATCH v7 1/7] vhost: fix missing memory table NUMA realloc Maxime Coquelin
2021-06-29 16:11 ` [dpdk-dev] [PATCH v7 2/7] vhost: fix missing guest pages " Maxime Coquelin
2021-06-29 16:11 ` [dpdk-dev] [PATCH v7 3/7] vhost: fix missing cache logging " Maxime Coquelin
2021-06-30 5:20 ` Xia, Chenbo
2021-06-29 16:11 ` [dpdk-dev] [PATCH v7 4/7] vhost: fix NUMA reallocation with multiqueue Maxime Coquelin
2021-06-30 5:20 ` Xia, Chenbo
2021-06-30 7:24 ` David Marchand
2021-06-30 7:47 ` Maxime Coquelin
2021-06-29 16:11 ` [dpdk-dev] [PATCH v7 5/7] vhost: improve NUMA reallocation Maxime Coquelin
2021-06-29 16:11 ` [dpdk-dev] [PATCH v7 6/7] vhost: allocate all data on same node as virtqueue Maxime Coquelin
2021-06-29 16:11 ` [dpdk-dev] [PATCH v7 7/7] vhost: convert inflight data to DPDK allocation API Maxime Coquelin
2021-06-30 5:20 ` Xia, Chenbo
2021-06-30 7:55 ` David Marchand [this message]
2021-06-30 11:16 ` Maxime Coquelin
2021-06-30 7:57 ` [dpdk-dev] [PATCH v7 0/7] vhost: Fix and improve NUMA reallocation David Marchand
2021-06-30 11:53 ` Xia, Chenbo
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=CAJFAV8xSSKjctj2L0b4yfE+abO6tLt3uqQVz7GRckMCUziQLew@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
/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).