From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id F19BE1B1C1 for ; Wed, 24 Jan 2018 16:41:32 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 8421822712; Wed, 24 Jan 2018 10:41:32 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 24 Jan 2018 10:41:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=wIUE9V8Qj/9eavb9H vKkDHQTEcLyTGSF2M9Wee+kBoQ=; b=Fq7MHkrg4gghMJ8F8zBsZoHS3tzHTtF2B 3/iIfurgkrivDJ1jIiJtEwKdR2VVlDtRAZ0oaf+UKrC9QbVTNP53aeKVSVKB0L96 o1fxMHnZreFTxEv2UBxw/e81Y97TDKTCtwJFkDlSae9JFz/ZCNrSfVpbPJ4shHQs tMb/QYfEBY/YLsL3NwDNqLhUnlJMZPTjYI9pwfi1opNkbdSE+VRXhxSMiIrVwWV8 1VKv/ist9mGA118307Ni7kNV7VZ5myoWsvFGL+QIzZJCRGcDqpNYmrHqcrfmlws6 DTiGseJgH/49A1YBwfzjo0tF55LLFcshUlwwYb6nNMubbhSAmRJXQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=wIUE9V8Qj/9eavb9HvKkDHQTEcLyTGSF2M9Wee+kBoQ=; b=aubhE0S/ uq4sToqI9AoCaLBiRHOK7lTBYyTDPX88Jl+xFM6iwdWjipD8i/hj7ImDYqA+onG8 gnmWG1y21Bt+C7GulM8zCXyruxt0oPdiBOVEdKKAamRNWD6edx12WLBQ7xKQQ2W7 DuGc/zlTBpb1klPappTw3vebNtRLKtv/hUh6UQjZ0OjEQTlSqZjDdqEwN4wNcxdX kIj8cgikZdCsPtTOcGBmtF6up/b4W9IdmBN8wuvS/jEnrw575MJElLPDWxfCXD3v tPNND895sb82yV4GcPwnKYmRWxa/b4w7nqZMv4YhRjKb1jbdw0/FK9PLjDgACu2m 0GS7GKjaMWjQ2A== X-ME-Sender: Received: from localhost.localdomain (unknown [115.150.27.206]) by mail.messagingengine.com (Postfix) with ESMTPA id 617867E3DB; Wed, 24 Jan 2018 10:41:30 -0500 (EST) From: Yuanhan Liu To: Olivier Matz Cc: Hanoch Haim , dpdk stable Date: Wed, 24 Jan 2018 23:33:14 +0800 Message-Id: <1516808026-25523-126-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> References: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'mbuf: fix performance of freeing with non atomic refcnt' has been queued to LTS release 17.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2018 15:41:33 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/26/18. So please shout if anyone has objections. Thanks. --yliu --- >>From 964b426f0087924f6d07d0009cf190d22a091e4f Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Fri, 8 Dec 2017 16:46:51 +0100 Subject: [PATCH] mbuf: fix performance of freeing with non atomic refcnt [ upstream commit 6d714a237d8a306837a5f87711f9af9063376fed ] When RTE_MBUF_REFCNT_ATOMIC=n, the decrement of the mbuf reference counter uses an atomic operation. This is not necessary and impacts the performance (seen with TRex traffic generator). We cannot replace rte_atomic16_add_return() by rte_mbuf_refcnt_update() because it would add an additional check. Solves this by introducing __rte_mbuf_refcnt_update(), which updates the reference counter without doing anything else. Fixes: 8f094a9ac5d7 ("mbuf: set mbuf fields while in pool") Suggested-by: Hanoch Haim Signed-off-by: Olivier Matz --- lib/librte_mbuf/rte_mbuf.h | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index e5d7643..bf85124 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -765,6 +765,13 @@ rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value) rte_atomic16_set(&m->refcnt_atomic, new_value); } +/* internal */ +static inline uint16_t +__rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) +{ + return (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, value)); +} + /** * Adds given value to an mbuf's refcnt and returns its new value. * @param m @@ -789,19 +796,26 @@ rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) return 1 + value; } - return (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, value)); + return __rte_mbuf_refcnt_update(m, value); } #else /* ! RTE_MBUF_REFCNT_ATOMIC */ +/* internal */ +static inline uint16_t +__rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) +{ + m->refcnt = (uint16_t)(m->refcnt + value); + return m->refcnt; +} + /** * Adds given value to an mbuf's refcnt and returns its new value. */ static inline uint16_t rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) { - m->refcnt = (uint16_t)(m->refcnt + value); - return m->refcnt; + return __rte_mbuf_refcnt_update(m, value); } /** @@ -1365,8 +1379,7 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m) return m; - } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) == 0) { - + } else if (__rte_mbuf_refcnt_update(m, -1) == 0) { if (RTE_MBUF_INDIRECT(m)) rte_pktmbuf_detach(m); -- 2.7.4