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 24AD4A49F for ; Tue, 23 Jan 2018 14:16:54 +0100 (CET) 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-us4.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 534FEBC0080; Tue, 23 Jan 2018 13:16:53 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Tue, 23 Jan 2018 05:16:49 -0800 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; Tue, 23 Jan 2018 05:16:49 -0800 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 w0NDGm4t006450; Tue, 23 Jan 2018 13:16:48 GMT 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 w0NDGleq010689; Tue, 23 Jan 2018 13:16:48 GMT From: Andrew Rybchenko To: CC: Olivier Matz , "Artem V. Andreev" Date: Tue, 23 Jan 2018 13:16:12 +0000 Message-ID: <1516713372-10572-18-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1516713372-10572-1-git-send-email-arybchenko@solarflare.com> References: <1511539591-20966-1-git-send-email-arybchenko@solarflare.com> <1516713372-10572-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-MDID: 1516713413-HIOQ8sN7aZ8K Subject: [dpdk-dev] [RFC v2 17/17] 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: Tue, 23 Jan 2018 13:16:54 -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 03fccf1..d1e7c27 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; } @@ -408,6 +419,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.7.4