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 79B89A0A0F; Wed, 30 Jun 2021 09:56:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E44A340141; Wed, 30 Jun 2021 09:56:14 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 9A5C540040 for ; Wed, 30 Jun 2021 09:56:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625039771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Rh7jSMcJFlYx/VLLwgYPUIVFUcdDSQW9+EjHpIR+ahw=; b=MSoO6RreQn5U3x9NVShv3tuXcDQDlNVk/gmJOzMS0UW4UhM/k2njZMzoy2pLhzfOnadZ37 ZoB0NSwDJnsO2WpBVZ8lr5ARIuO/wF2ogcHVFjJeRUcLvLSMD/4BAlXWd4abD4RfXsf5/I y7FWV18wmQEdP77CHGaWj/rDV2Ph2c8= Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-567-SrZfxszSOVKSFmeWt7oDpg-1; Wed, 30 Jun 2021 03:56:09 -0400 X-MC-Unique: SrZfxszSOVKSFmeWt7oDpg-1 Received: by mail-vs1-f72.google.com with SMTP id t18-20020a67bc120000b029027205cd0f2eso691537vsn.14 for ; Wed, 30 Jun 2021 00:56:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Rh7jSMcJFlYx/VLLwgYPUIVFUcdDSQW9+EjHpIR+ahw=; b=uIM2F/ACnnEu0AEOH+jCiFGC4ocF+jLu304/NRf7atiDtzVqjyv+ub/Ov0r5acE2JO UwpT+zYPBExZtRZ0s9rSWpkuz10mA0dn+16SZXfxv/Co5E1LIFo2vIVl57UHnW03umwy oVmFfERL+LPwNzxV7aph0Kl5IBSWg5Kvn+YrBto4rn7a3Ou1Wa9L4Mg3EqsHY9UzrXR5 z1eB53VMcg2htVUrhbGjMNm9J3PBpljvOVSvrRzQLacpkNwBPhiAizDYPtYSYeLiMkzY lmrVF6kSmY1HCWY4U6XbGY6qYWXItiN743GyZg86hANg2tKsAVT50hyihKzmznN0yZYv jEBg== X-Gm-Message-State: AOAM531bLONH0YtBwH7tLmnPKYaGgsfqIRyBndaiX6SkCvxB5mySJ3ho mEGyimS1VRXZEEsgQKiiUeNmWHE/n+I8wjuEbEy8p0PRJGmcly4QjYOQ25SIshtgqnMBbXNrese /tLAEKUJ1mofbqPN1yCI= X-Received: by 2002:a67:df85:: with SMTP id x5mr29205224vsk.17.1625039768732; Wed, 30 Jun 2021 00:56:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJws4mU6t4oAene9jD0ZtO5pO7WVFr7igMI5cfWi6XCneGffeP7LpIuNAUKZ6ED7fSS/rXM70HVoXUvrNzwUNI0= X-Received: by 2002:a67:df85:: with SMTP id x5mr29205215vsk.17.1625039768553; Wed, 30 Jun 2021 00:56:08 -0700 (PDT) MIME-Version: 1.0 References: <20210629161133.79472-1-maxime.coquelin@redhat.com> <20210629161133.79472-8-maxime.coquelin@redhat.com> In-Reply-To: <20210629161133.79472-8-maxime.coquelin@redhat.com> From: David Marchand Date: Wed, 30 Jun 2021 09:55:57 +0200 Message-ID: To: Maxime Coquelin Cc: dev , "Xia, Chenbo" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v7 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" On Tue, Jun 29, 2021 at 6:11 PM Maxime Coquelin 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 [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