From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by dpdk.org (Postfix) with ESMTP id 01320ADBE for ; Wed, 25 Jun 2014 09:46:38 +0200 (CEST) Received: by mail-wi0-f182.google.com with SMTP id bs8so1955881wib.9 for ; Wed, 25 Jun 2014 00:46:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=8vU9i/YMy370dljW1oloTdi78cMr3rpsH1TKLPZZvjo=; b=AQ7LHX1bPn9eMIxm1W+BEgaGnO+l6pM50igVr39Qs27WL+yTKJAsYT2gj3wPuiF6ID 51XNTEN+SF77Tpe5NU846G3lJkqk8+V8T5+m2YqpwAdft09Ie7ZsUwj3fflw+JNyg1kP lijljiR66xJwphpcWmaF34GkOxTj2lHZWuph9ik7BJ8zJX+CbH5DI+J0fv8QVvOYQy9V 1xVkfk9iQfJZ4bMM8/A48L+XRyWAakpwSN6/HLyZeRjrAOX3ArIAPr7OaUUkBSe/9v/o GDVKhJldLhO5STCsY9fX+sNc/Qg8p8kdE3BLzgf8/JR0W2w54kzxjkBf49FfQ4jWsFAt IYWw== X-Gm-Message-State: ALoCoQmXaxZ7LtMbCP6YYFsATxCtRNTz1mZXKdwd7mKQcwMt2HC79UgQZy9gtiJPmSsHh/Fu5Wng X-Received: by 10.180.90.233 with SMTP id bz9mr8387070wib.42.1403682414178; Wed, 25 Jun 2014 00:46:54 -0700 (PDT) Received: from [10.16.0.195] (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id gi7sm50862859wib.1.2014.06.25.00.46.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Jun 2014 00:46:53 -0700 (PDT) Message-ID: <53AA7E64.5060707@6wind.com> Date: Wed, 25 Jun 2014 09:46:44 +0200 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: Stephen Hemminger , "dev@dpdk.org" References: <20140624084948.6d4ab3cd@nehalam.linuxnetplumber.net> In-Reply-To: <20140624084948.6d4ab3cd@nehalam.linuxnetplumber.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] mempool: don't leak ring on failure 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: Wed, 25 Jun 2014 07:46:39 -0000 Hello Stephen, On 06/24/2014 05:49 PM, Stephen Hemminger wrote: > If mempool can not be created because of insufficient memory > it returns an error but has already created a ring (and leaves it > behind). This prevents code from trying one mempool size and then > retrying with a smaller size if the bigger size fails. > > Reordering to do ring creation after getting memory fixes > the problem. Your patch moves the creation of the ring after the call to rte_memzone_reserve(), so now it tries to create the memory for the object pool before the ring. The problem disappears because the object pool is usually much bigger than the ring, so once the first allocation is done, the second is unlikely to fail. I think this explanation could be added in the commit log. Acked-by: Olivier Matz