From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 90111293B for ; Mon, 6 Feb 2017 14:51:08 +0100 (CET) Received: by mail-wm0-f50.google.com with SMTP id c85so121214110wmi.1 for ; Mon, 06 Feb 2017 05:51:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ySfGIkLGFhMSplASOko23xjQlkOmd+9eMGxCMhrnSZs=; b=tcoL28BNAu6rhDzGEcPDGinaAQnBXOlKqQH4g+eoNxYXdkuS7NiNi5/TTjvtcDLItk 2/cMKEYPXL3KE+XT4RQZwYKvpYuntesbxNy1xupPnGyncuHYAZGF5MBx4ty4sQ7P4Om2 Xa4RrH0i3e20z1EoZCCjCoVOAgNV+w6BjY00F5HAW4DOuxEfR6FCK7HXK2zQeeIwKx0S 1mJVBDG3OqiodpCIHNCmOxyEOEWbz6MZewPZYiMLpqzDDlp459cV7eXQ5K6W8LVjkbr3 Uv+hXGqAMJZTODkwiXwsUm8gQ/oC7M5CWFS4De/dJ7+jxiqwGQ1d2aMCry/AbE/uP3lX XXFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ySfGIkLGFhMSplASOko23xjQlkOmd+9eMGxCMhrnSZs=; b=ll578CPyrH0N7jWwAkWGJEQODTl8pASGIoENJcIQk09nFxvsCPF0xtHN9o89fnouW+ lpBniaPEmGeKl8dBG+LtKgTf9pzBhllLT2t2dgqyGvqUpjlp6EwpJNRzRcUnxS//8J/R uIBqovNuAyCIZY7c2kYcSiFJzQKsSZ+kByTg9TbZgxwhVXl4d/IKLRE+nKbmbWuwy3Qa MyaA9x8HzXzxeCt7GwO3OAKEZOcHbgWW+CZP7g+7shNO4rlsAKmQ2jE1pUdJyI7hAmjD 5KRZBqO/mhcObDAouGPyjZ8SC6cebvnkJ5E3dhAJkiArk6iflvtRjep5W1e5IgbJaA5E pgqw== X-Gm-Message-State: AIkVDXKYBS4ty3Giv4mqeMPu0cGpRxIDhW3xSbdQMHX9QnDoo2e4OkMtS1h294HcjrcoZSju X-Received: by 10.223.145.163 with SMTP id 32mr11203426wri.198.1486389068290; Mon, 06 Feb 2017 05:51:08 -0800 (PST) Received: from platinum (2a01cb0c03c651000226b0fffeed02fc.ipv6.abo.wanadoo.fr. [2a01:cb0c:3c6:5100:226:b0ff:feed:2fc]) by smtp.gmail.com with ESMTPSA id 40sm1611084wry.22.2017.02.06.05.51.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Feb 2017 05:51:08 -0800 (PST) Date: Mon, 6 Feb 2017 14:51:05 +0100 From: Olivier Matz To: vlad.lazarenko@worldquant.com, users@dpdk.org Message-ID: <20170206145105.6a9016ec@platinum> In-Reply-To: <790E2AC11206AC46B8F4BB82078E34F8062736DF@EXUSMBX02.AD.MLP.com> References: <790E2AC11206AC46B8F4BB82078E34F8062736DF@EXUSMBX02.AD.MLP.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-users] Optimal number of elements in mempool n = (2^q - 1) vs examples, what is the right thing to do? X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2017 13:51:08 -0000 Hi Vlad, On Wed, 1 Feb 2017 16:54:57 +0000, Vlad.Lazarenko at worldquant.com (Lazarenko, Vlad (WorldQuant)) wrote: > Hello, > > I'm new to DPDK and have noticed that documentation for > rte_mempool_create states that the optimal size for a number of > elements in the pool is n = (2^q-1). But in many examples it is > simply set to 2^q (multi_process/simple_mp/main.c uses 2014, for > example). This is a bit confusing. Is 2^q - 1 really the optimal > number but examples don't use it, or maybe the documentation for the > mempool is wrong, or...? If anyone could shed some light on this > that'd be helpful. That's true for rte_mempool based on a rte_ring (this is the default, but since recently, it's possible to use another handler). The size of a rte_ring is (2^n - 1), because one element in the ring is reserved to distinguish between a full an an empty ring. So, when a mempool uses a ring, if we ask for 2^n elements, a ring of size (2^(n+1) - 1) is created, which can consume additional memory. On the other hand, the mempool object size is often much larger than a ring entry (usually 8 bytes, the size of a pointer), especially knowing that by default, the objects are cache aligned (usually 64 bytes). So we may remove this note in the future since it's not very relevant. Regards, Olivier > > ################################################################################### > > The information contained in this communication is confidential, may > be > > subject to legal privilege, and is intended only for the individual > named. > > If you are not the named addressee, please notify the sender > immediately and > > delete this email from your system. The views expressed in this > email are > > the views of the sender only. Outgoing and incoming electronic > communications > > to this address are electronically archived and subject to review > and/or disclosure > > to someone other than the recipient. > > ################################################################################### You can remove this confidential notice for public mailing list :)