From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33EFDA0518 for ; Fri, 24 Jul 2020 14:12:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A7321C2BB; Fri, 24 Jul 2020 14:12:07 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id F1B7E1C2E8 for ; Fri, 24 Jul 2020 14:12:05 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id g10so8475961wmc.1 for ; Fri, 24 Jul 2020 05:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SPPOHNXiYaGxacM5hBm8Ip44SWdV11wHKuohnIPeJj8=; b=u9/IQdZK+s9/X5YYr1wbninZWOWuwSrEniBVTBftivpyeIYRojajQeASsmeohRAGh4 g+yJb37edK2vMRCPA0/Rd0yO8QwkIbSQ+1E8ukK89ixD4iXhW/6V3D8TxY+JOG34yn8N 9hMMNULIoXmHkmQ1ax8tmgbJ4EpCJZ3y3Wc2wfVgifIEP9mIl9QdX2TYzX8MdMU6T5kk WfZ6NFv9xkCSiVvZ6Pd8lLNl3fCh1HEzllA6lkizPBu16l827/igseBpeS8UerbSoKUx uLq/8siCRVMxhFFQzlb1JsRBNfLH1NPWc4u4t0KlyIA1IIMEXuAotPkMFGf2QMH/sgxO jglw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SPPOHNXiYaGxacM5hBm8Ip44SWdV11wHKuohnIPeJj8=; b=Kzr4oK3GQjcrFo3KqNamaaQl2Qj6v6pfPFgwrdEYaUOdPPHubZuOcZr23KzBV4XN/L bZIt4EZayGPRc/cnlmOt0JkTrCsXqEmSEi6fmzWlSVNsXxRDKWD3vzribgCbwTwKAdqR wIlJbaDI7NHL5wBRGsdmeZ8Q4vXZCoJcdni3v4QQ7mgUgOdVa7GyriMMMiu63LZK7Z06 HPIVRxNMRMqYABg6b5JOpJ7I2sBW8Pm7x5GC1spkDRQmFI2xNmmuueSvV7m17yINU31+ USsloIlhyn8bZr44PGH+Gfu3mYCII9s/TW539JJe4Km4hA1irrhTJYDC+HySfzK7zUxh c0yQ== X-Gm-Message-State: AOAM533t2huJgXAg7MKfOzh0Qt/lMdZrvDXvcSbHxt2iPIoZJElJ92ey tOpocqXI4LBIrYfbIlLY3tk= X-Google-Smtp-Source: ABdhPJyBEfP8nib/zbytBY9/Pty4tIBRUr75qh9BhyI417j+tq7o9Qsl0XcMszvX8NiLilGXjiTFmg== X-Received: by 2002:a1c:ab84:: with SMTP id u126mr8232177wme.43.1595592725729; Fri, 24 Jul 2020 05:12:05 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id k14sm1079391wrn.76.2020.07.24.05.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 05:12:04 -0700 (PDT) From: luca.boccassi@gmail.com To: Zhike Wang Cc: Andrew Rybchenko , Anatoly Burakov , dpdk stable Date: Fri, 24 Jul 2020 13:00:18 +0100 Message-Id: <20200724120030.1863487-180-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200724120030.1863487-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'mempool: fix allocation in memzone during retry' has been queued to stable release 19.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/26/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From fe11e4ef38d6a932881ad0424853736159eeb890 Mon Sep 17 00:00:00 2001 From: Zhike Wang Date: Tue, 14 Jul 2020 15:26:05 +0800 Subject: [PATCH] mempool: fix allocation in memzone during retry [ upstream commit 9dbe628a7ba2420d00bf8c15d066f9667092db2b ] If allocation is successful on the first attempt, typically there is no problem since we allocated everything required and we'll terminate the loop (if memory chunk is really sufficient to populate required number of mempool elements). If the first attempt fails, we try to allocate half of mem_size and it succeed, we'll have one more iteration of the for-loop to allocate memory for remaining elements and should not try the next time with quarter of the mem_size. It is wrong that max_alloc_size is divided by 2 in the case of successful allocation as well, or invalid memory can be allocated, and leads to population failure, then errno other than ENOMEM may be returned. Fixes: 3a3d0c75b43e ("mempool: fix slow allocation of large pools") Signed-off-by: Andrew Rybchenko Signed-off-by: Zhike Wang Acked-by: Anatoly Burakov --- lib/librte_mempool/rte_mempool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 08906df9e..e39135d47 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -569,7 +569,7 @@ rte_mempool_populate_default(struct rte_mempool *mp) RTE_MIN((size_t)mem_size, max_alloc_size), mp->socket_id, mz_flags, align); - if (mz == NULL && rte_errno != ENOMEM) + if (mz != NULL || rte_errno != ENOMEM) break; max_alloc_size = RTE_MIN(max_alloc_size, -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-07-24 12:53:55.494319622 +0100 +++ 0180-mempool-fix-allocation-in-memzone-during-retry.patch 2020-07-24 12:53:48.603012347 +0100 @@ -1,8 +1,10 @@ -From 9dbe628a7ba2420d00bf8c15d066f9667092db2b Mon Sep 17 00:00:00 2001 +From fe11e4ef38d6a932881ad0424853736159eeb890 Mon Sep 17 00:00:00 2001 From: Zhike Wang Date: Tue, 14 Jul 2020 15:26:05 +0800 Subject: [PATCH] mempool: fix allocation in memzone during retry +[ upstream commit 9dbe628a7ba2420d00bf8c15d066f9667092db2b ] + If allocation is successful on the first attempt, typically there is no problem since we allocated everything required and we'll terminate the loop (if memory chunk is really sufficient @@ -19,7 +21,6 @@ other than ENOMEM may be returned. Fixes: 3a3d0c75b43e ("mempool: fix slow allocation of large pools") -Cc: stable@dpdk.org Signed-off-by: Andrew Rybchenko Signed-off-by: Zhike Wang @@ -29,10 +30,10 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c -index a2bd24984..7774f0c8d 100644 +index 08906df9e..e39135d47 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c -@@ -635,7 +635,7 @@ rte_mempool_populate_default(struct rte_mempool *mp) +@@ -569,7 +569,7 @@ rte_mempool_populate_default(struct rte_mempool *mp) RTE_MIN((size_t)mem_size, max_alloc_size), mp->socket_id, mz_flags, align);