From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id A809C2C72 for ; Fri, 3 Jul 2015 15:32:17 +0200 (CEST) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=[192.168.0.10]) by mail.droids-corp.org with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1ZB19Q-0006NG-Jx; Fri, 03 Jul 2015 15:37:11 +0200 Message-ID: <55968ED8.2060904@6wind.com> Date: Fri, 03 Jul 2015 15:32:08 +0200 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Zoltan Kiss , dev@dpdk.org References: <1435258110-17140-1-git-send-email-zoltan.kiss@linaro.org> <1435741430-2088-1-git-send-email-zoltan.kiss@linaro.org> In-Reply-To: <1435741430-2088-1-git-send-email-zoltan.kiss@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] mempool: improve cache search X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2015 13:32:17 -0000 On 07/01/2015 11:03 AM, Zoltan Kiss wrote: > The current way has a few problems: > > - if cache->len < n, we copy our elements into the cache first, then > into obj_table, that's unnecessary > - if n >= cache_size (or the backfill fails), and we can't fulfil the > request from the ring alone, we don't try to combine with the cache > - if refill fails, we don't return anything, even if the ring has enough > for our request > > This patch rewrites it severely: > - at the first part of the function we only try the cache if cache->len < n > - otherwise take our elements straight from the ring > - if that fails but we have something in the cache, try to combine them > - the refill happens at the end, and its failure doesn't modify our return > value > > Signed-off-by: Zoltan Kiss Acked-by: Olivier Matz