From mboxrd@z Thu Jan 1 00:00:00 1970 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 90DB17CF6 for ; Thu, 26 Apr 2018 12:59:34 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 6589B94006C; Thu, 26 Apr 2018 10:59:33 +0000 (UTC) Received: from sfocexch01r.SolarFlarecom.com (10.20.40.34) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 26 Apr 2018 03:59:31 -0700 Received: from ocex03.SolarFlarecom.com (10.20.40.36) by sfocexch01r.SolarFlarecom.com (10.20.40.34) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 26 Apr 2018 03:59:29 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Thu, 26 Apr 2018 03:59:28 -0700 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w3QAxRBU008923; Thu, 26 Apr 2018 11:59:27 +0100 Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w3QAxRLM003122; Thu, 26 Apr 2018 11:59:27 +0100 From: Andrew Rybchenko To: CC: Olivier MATZ , "Artem V. Andreev" Date: Thu, 26 Apr 2018 11:59:23 +0100 Message-ID: <1524740363-3081-6-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1524740363-3081-1-git-send-email-arybchenko@solarflare.com> References: <1511539591-20966-1-git-send-email-arybchenko@solarflare.com> <1524740363-3081-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-MDID: 1524740373-lfoCwrW7ZOjY Subject: [dpdk-dev] [PATCH v4 5/5] mempool/bucket: do not allow one lcore to grab all buckets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Apr 2018 10:59:34 -0000 From: "Artem V. Andreev" Signed-off-by: Artem V. Andreev Signed-off-by: Andrew Rybchenko --- drivers/mempool/bucket/rte_mempool_bucket.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/mempool/bucket/rte_mempool_bucket.c b/drivers/mempool/bucket/rte_mempool_bucket.c index 24be24e96..78d2b9d04 100644 --- a/drivers/mempool/bucket/rte_mempool_bucket.c +++ b/drivers/mempool/bucket/rte_mempool_bucket.c @@ -42,6 +42,7 @@ struct bucket_data { unsigned int header_size; unsigned int total_elt_size; unsigned int obj_per_bucket; + unsigned int bucket_stack_thresh; uintptr_t bucket_page_mask; struct rte_ring *shared_bucket_ring; struct bucket_stack *buckets[RTE_MAX_LCORE]; @@ -139,6 +140,7 @@ bucket_enqueue(struct rte_mempool *mp, void * const *obj_table, unsigned int n) { struct bucket_data *bd = mp->pool_data; + struct bucket_stack *local_stack = bd->buckets[rte_lcore_id()]; unsigned int i; int rc = 0; @@ -146,6 +148,15 @@ bucket_enqueue(struct rte_mempool *mp, void * const *obj_table, rc = bucket_enqueue_single(bd, obj_table[i]); RTE_ASSERT(rc == 0); } + if (local_stack->top > bd->bucket_stack_thresh) { + rte_ring_enqueue_bulk(bd->shared_bucket_ring, + &local_stack->objects + [bd->bucket_stack_thresh], + local_stack->top - + bd->bucket_stack_thresh, + NULL); + local_stack->top = bd->bucket_stack_thresh; + } return rc; } @@ -409,6 +420,8 @@ bucket_alloc(struct rte_mempool *mp) bd->obj_per_bucket = (bd->bucket_mem_size - bucket_header_size) / bd->total_elt_size; bd->bucket_page_mask = ~(rte_align64pow2(bd->bucket_mem_size) - 1); + /* eventually this should be a tunable parameter */ + bd->bucket_stack_thresh = (mp->size / bd->obj_per_bucket) * 4 / 3; if (mp->flags & MEMPOOL_F_SP_PUT) rg_flags |= RING_F_SP_ENQ; -- 2.14.1