From patchwork Wed Mar 29 09:16:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leyi Rong X-Patchwork-Id: 125590 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CF30442862; Wed, 29 Mar 2023 11:17:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 68E5140F18; Wed, 29 Mar 2023 11:17:10 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 9BDD440EE7 for ; Wed, 29 Mar 2023 11:17:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680081428; x=1711617428; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=uHlxbpJ8DY9SuX2LgIcdgW8Uz2yWZ8rDCsB5Tudkm74=; b=WrWv532sacoCghfd/b82+hzISbN2RuxM+CUseelFuoB5ywZybMV72Eqa bcS4ArzruSjHKX10Zf31pddsx1RsQBFkg5Mo2nNSwwh6D3kCsBTz4Hxf+ iEBkUIq/ajY7/LUZxjJFgJ5uXDR6YvaBEONw8xn+wy7PTjaSh1nevCmVs I+20shCZ03XbUPxeYgK0zUWT+csQxVKdybU4fOvzoAz/ut/A0tTyLa5kn d0rM+luFP+sBr9HrrPZ9nH7DMBqJBEcH5BVbFXIb1+eV6Z1hJn1Hi4Pfd wkJtcZ364cubGrWIW7cwvg+YyIonVuM1mLIIYzg1TK86JRij7LEiol07w w==; X-IronPort-AV: E=McAfee;i="6600,9927,10663"; a="368595325" X-IronPort-AV: E=Sophos;i="5.98,300,1673942400"; d="scan'208";a="368595325" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2023 02:17:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10663"; a="753505550" X-IronPort-AV: E=Sophos;i="5.98,300,1673942400"; d="scan'208";a="753505550" Received: from dpdk-lrong-icx-01.sh.intel.com ([10.67.119.18]) by fmsmga004.fm.intel.com with ESMTP; 29 Mar 2023 02:17:03 -0700 From: Leyi Rong To: mb@smartsharesystems.com, bruce.richardson@intel.com Cc: dev@dpdk.org, Leyi Rong Subject: [PATCH] eal/x86: remove redundant round to improve performance Date: Wed, 29 Mar 2023 17:16:58 +0800 Message-Id: <20230329091658.1599349-1-leyi.rong@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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 rte_memcpy_aligned(), one redundant round is taken in the 64 bytes block copy loops if the size is a multiple of 64. So, let the catch-up copy the last 64 bytes in this case. Suggested-by: Morten Brørup Signed-off-by: Leyi Rong Reviewed-by: Morten Brørup Acked-by: Bruce Richardson Reviewed-by: David Marchand --- lib/eal/x86/include/rte_memcpy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h index d4d7a5cfc8..fd151be708 100644 --- a/lib/eal/x86/include/rte_memcpy.h +++ b/lib/eal/x86/include/rte_memcpy.h @@ -846,7 +846,7 @@ rte_memcpy_aligned(void *dst, const void *src, size_t n) } /* Copy 64 bytes blocks */ - for (; n >= 64; n -= 64) { + for (; n > 64; n -= 64) { rte_mov64((uint8_t *)dst, (const uint8_t *)src); dst = (uint8_t *)dst + 64; src = (const uint8_t *)src + 64;