From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Rybchenko Subject: [RFC PATCH 4/6] mempool: add a function to flush default cache Date: Fri, 24 Nov 2017 16:06:29 +0000 Message-ID: <1511539591-20966-5-git-send-email-arybchenko@solarflare.com> References: <1511539591-20966-1-git-send-email-arybchenko@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Olivier Matz , "Artem V. Andreev" To: Return-path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id B434020F for ; Fri, 24 Nov 2017 17:07:06 +0100 (CET) In-Reply-To: <1511539591-20966-1-git-send-email-arybchenko@solarflare.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: "Artem V. Andreev" Mempool get/put API cares about cache itself, but sometimes it is required to flush the cache explicitly. Also dedicated API allows to decouple it from block get API (to be added) and provides more fine-grained control. Signed-off-by: Artem V. Andreev Signed-off-by: Andrew Rybchenko --- lib/librte_mempool/rte_mempool.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 9bcb8b7..3a52b93 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -1161,6 +1161,22 @@ rte_mempool_default_cache(struct rte_mempool *mp, unsigned lcore_id) } /** + * Ensure that a default per-lcore mempool cache is flushed, if it is present + * + * @param mp + * A pointer to the mempool structure. + */ +static __rte_always_inline void +rte_mempool_ensure_cache_flushed(struct rte_mempool *mp) +{ + struct rte_mempool_cache *cache; + cache = rte_mempool_default_cache(mp, rte_lcore_id()); + if (cache != NULL && cache->len > 0) + rte_mempool_cache_flush(cache, mp); +} + + +/** * @internal Put several objects back in the mempool; used internally. * @param mp * A pointer to the mempool structure. -- 2.7.4