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 B07F6A00C2; Thu, 17 Nov 2022 08:55:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5884940DDC; Thu, 17 Nov 2022 08:55:51 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 7568140DDA; Thu, 17 Nov 2022 08:55:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668671749; x=1700207749; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=f9nezRHOsQefN7GF32+DvOOZMn0MvT9MkIUUE7xDKjU=; b=GCTMIogpnMkxGNI8rx+7oSFQVw+El4evZLTmGakguIkCVzoLvUa0Qmux 8X4G5ZHARoDtzu4G5PlKKNsEFph9Rhco8v7AJGtz8fRGgzGydaibImnCF Ig/0LHIqZcQhhLtclmA6DX8X1R5wQa+9n0gLAoYAt9declZoo3HU4Dsnt iY+RSwBACDF86NYYqkagTqJLc9XYCdPF3SAdpfRIR0X5DJZd6KgIhflKe xwgGBzHwwaZoRXtY/bwOzW1ii+0noePtFSFgf3MKj+JwxkXMJlvO6Ar6y 7EaWxz0s7610V1g+KZKVIsGe7yRm7SL94nHb9akQ7EUTdk5BNW5r9fwMr g==; X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="292492528" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="292492528" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2022 23:55:48 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="633964707" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="633964707" Received: from unknown (HELO cj..) ([10.239.252.106]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2022 23:55:45 -0800 From: Kaisen You To: dev@dpdk.org Cc: stable@dpdk.org, qiming.yang@intel.com, yidingx.zhou@intel.com, Kaisen You , Jingjing Wu , Beilei Xing , Qi Zhang Subject: [PATCH] net/iavf:fix slow memory allocation Date: Thu, 17 Nov 2022 06:57:26 +0000 Message-Id: <20221117065726.277672-1-kaisenx.you@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 In some cases, the DPDK does not allocate hugepage heap memory to some sockets due to the user setting parameters (e.g. -l 40-79, SOCKET 0 has no memory). When the interrupt thread runs on the corresponding core of this socket, each allocation/release will execute a whole set of heap allocation/release operations,resulting in poor performance. Instead we call malloc() to get memory from the system's heap space to fix this problem. Fixes: cb5c1b91f76f ("net/iavf: add thread for event callbacks") Cc: stable@dpdk.org Signed-off-by: Kaisen You --- drivers/net/iavf/iavf_vchnl.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index f92daf97f2..a05791fe48 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -36,7 +36,6 @@ struct iavf_event_element { struct rte_eth_dev *dev; enum rte_eth_event_type event; void *param; - size_t param_alloc_size; uint8_t param_alloc_data[0]; }; @@ -80,7 +79,7 @@ iavf_dev_event_handle(void *param __rte_unused) TAILQ_FOREACH_SAFE(pos, &pending, next, save_next) { TAILQ_REMOVE(&pending, pos, next); rte_eth_dev_callback_process(pos->dev, pos->event, pos->param); - rte_free(pos); + free(pos); } } @@ -94,14 +93,13 @@ iavf_dev_event_post(struct rte_eth_dev *dev, { struct iavf_event_handler *handler = &event_handler; char notify_byte; - struct iavf_event_element *elem = rte_malloc(NULL, sizeof(*elem) + param_alloc_size, 0); + struct iavf_event_element *elem = malloc(sizeof(*elem) + param_alloc_size); if (!elem) return; elem->dev = dev; elem->event = event; elem->param = param; - elem->param_alloc_size = param_alloc_size; if (param && param_alloc_size) { rte_memcpy(elem->param_alloc_data, param, param_alloc_size); elem->param = elem->param_alloc_data; @@ -165,7 +163,7 @@ iavf_dev_event_handler_fini(void) struct iavf_event_element *pos, *save_next; TAILQ_FOREACH_SAFE(pos, &handler->pending, next, save_next) { TAILQ_REMOVE(&handler->pending, pos, next); - rte_free(pos); + free(pos); } } -- 2.34.1