patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 1/4] eal: fix list index for 256 byte element
       [not found] <20230519042923.314670-1-ruifeng.wang@arm.com>
@ 2023-05-19  4:29 ` Ruifeng Wang
  2023-05-19 11:10   ` Burakov, Anatoly
  2023-05-19  4:29 ` [PATCH 3/4] test/malloc: fix missing free Ruifeng Wang
  2023-05-19  4:29 ` [PATCH 4/4] test/malloc: fix case expectation Ruifeng Wang
  2 siblings, 1 reply; 6+ messages in thread
From: Ruifeng Wang @ 2023-05-19  4:29 UTC (permalink / raw)
  To: Anatoly Burakov, Fengnan Chang, Morten Brørup
  Cc: dev, honnappa.nagarahalli, feifei.wang2, nd, Ruifeng Wang, stable

Elements with 2^8B size should fall into index 1 of the list.

Fixes: f62f4a375ff4 ("malloc: optimize 4K allocations")
Cc: changfengnan@bytedance.com
Cc: stable@dpdk.org

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/eal/common/malloc_elem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/common/malloc_elem.c b/lib/eal/common/malloc_elem.c
index 35a2313d04..619c040aa3 100644
--- a/lib/eal/common/malloc_elem.c
+++ b/lib/eal/common/malloc_elem.c
@@ -382,7 +382,7 @@ malloc_elem_free_list_index(size_t size)
 	size_t log2;
 	size_t index;
 
-	if (size <= (1UL << MALLOC_MINSIZE_LOG2))
+	if (size < (1UL << MALLOC_MINSIZE_LOG2))
 		return 0;
 
 	/* Find next power of 2 > size. */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] test/malloc: fix missing free
       [not found] <20230519042923.314670-1-ruifeng.wang@arm.com>
  2023-05-19  4:29 ` [PATCH 1/4] eal: fix list index for 256 byte element Ruifeng Wang
@ 2023-05-19  4:29 ` Ruifeng Wang
  2023-05-19 11:08   ` Burakov, Anatoly
  2023-05-19  4:29 ` [PATCH 4/4] test/malloc: fix case expectation Ruifeng Wang
  2 siblings, 1 reply; 6+ messages in thread
From: Ruifeng Wang @ 2023-05-19  4:29 UTC (permalink / raw)
  To: Anatoly Burakov
  Cc: dev, honnappa.nagarahalli, feifei.wang2, nd, Ruifeng Wang, stable

Free the allocated buffer before returning.

Fixes: a40a1f8231b4 ("app: various tests update")
Cc: stable@dpdk.org

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
---
 app/test/test_malloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index de40e50611..f144b89d88 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -937,6 +937,7 @@ test_alloc_single_socket(int32_t socket)
 	if (mem == NULL)
 		return -1;
 	if (addr_to_socket(mem) != desired_socket) {
+		rte_free(mem);
 		return -1;
 	}
 	rte_free(mem);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] test/malloc: fix case expectation
       [not found] <20230519042923.314670-1-ruifeng.wang@arm.com>
  2023-05-19  4:29 ` [PATCH 1/4] eal: fix list index for 256 byte element Ruifeng Wang
  2023-05-19  4:29 ` [PATCH 3/4] test/malloc: fix missing free Ruifeng Wang
@ 2023-05-19  4:29 ` Ruifeng Wang
  2023-05-19 11:07   ` Burakov, Anatoly
  2 siblings, 1 reply; 6+ messages in thread
From: Ruifeng Wang @ 2023-05-19  4:29 UTC (permalink / raw)
  To: Anatoly Burakov
  Cc: dev, honnappa.nagarahalli, feifei.wang2, nd, Ruifeng Wang, stable

The case expects all stats to be equal. Therefor the conditions
in check should be logically or'ed.

Fixes: a40a1f8231b4 ("app: various tests update")
Cc: stable@dpdk.org

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
---
 app/test/test_malloc.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index f144b89d88..ff081dd931 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -302,11 +302,11 @@ test_multi_alloc_statistics(void)
 	rte_malloc_get_socket_stats(socket,&post_stats);
 	/* Check statistics reported are correct */
 	/* All post stats should be equal to pre stats after alloc freed */
-	if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
-			(post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
-			(post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
-			(post_stats.alloc_count!=pre_stats.alloc_count)&&
-			(post_stats.free_count!=pre_stats.free_count)) {
+	if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) ||
+			(post_stats.heap_freesz_bytes != pre_stats.heap_freesz_bytes) ||
+			(post_stats.heap_allocsz_bytes != pre_stats.heap_allocsz_bytes) ||
+			(post_stats.alloc_count != pre_stats.alloc_count) ||
+			(post_stats.free_count != pre_stats.free_count)) {
 		printf("Malloc statistics are incorrect - freed alloc\n");
 		return -1;
 	}
@@ -363,11 +363,11 @@ test_multi_alloc_statistics(void)
 		return -1;
 	}
 
-	if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
-			(post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
-			(post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
-			(post_stats.alloc_count!=pre_stats.alloc_count)&&
-			(post_stats.free_count!=pre_stats.free_count)) {
+	if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) ||
+			(post_stats.heap_freesz_bytes != pre_stats.heap_freesz_bytes) ||
+			(post_stats.heap_allocsz_bytes != pre_stats.heap_allocsz_bytes) ||
+			(post_stats.alloc_count != pre_stats.alloc_count) ||
+			(post_stats.free_count != pre_stats.free_count)) {
 		printf("Malloc statistics are incorrect - freed alloc\n");
 		return -1;
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 4/4] test/malloc: fix case expectation
  2023-05-19  4:29 ` [PATCH 4/4] test/malloc: fix case expectation Ruifeng Wang
@ 2023-05-19 11:07   ` Burakov, Anatoly
  0 siblings, 0 replies; 6+ messages in thread
From: Burakov, Anatoly @ 2023-05-19 11:07 UTC (permalink / raw)
  To: Ruifeng Wang; +Cc: dev, honnappa.nagarahalli, feifei.wang2, nd, stable

On 5/19/2023 5:29 AM, Ruifeng Wang wrote:
> The case expects all stats to be equal. Therefor the conditions
> in check should be logically or'ed.
> 
> Fixes: a40a1f8231b4 ("app: various tests update")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/4] test/malloc: fix missing free
  2023-05-19  4:29 ` [PATCH 3/4] test/malloc: fix missing free Ruifeng Wang
@ 2023-05-19 11:08   ` Burakov, Anatoly
  0 siblings, 0 replies; 6+ messages in thread
From: Burakov, Anatoly @ 2023-05-19 11:08 UTC (permalink / raw)
  To: Ruifeng Wang; +Cc: dev, honnappa.nagarahalli, feifei.wang2, nd, stable

On 5/19/2023 5:29 AM, Ruifeng Wang wrote:
> Free the allocated buffer before returning.
> 
> Fixes: a40a1f8231b4 ("app: various tests update")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> ---
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] eal: fix list index for 256 byte element
  2023-05-19  4:29 ` [PATCH 1/4] eal: fix list index for 256 byte element Ruifeng Wang
@ 2023-05-19 11:10   ` Burakov, Anatoly
  0 siblings, 0 replies; 6+ messages in thread
From: Burakov, Anatoly @ 2023-05-19 11:10 UTC (permalink / raw)
  To: Ruifeng Wang, Fengnan Chang, Morten Brørup
  Cc: dev, honnappa.nagarahalli, feifei.wang2, nd, stable

On 5/19/2023 5:29 AM, Ruifeng Wang wrote:
> Elements with 2^8B size should fall into index 1 of the list.
> 
> Fixes: f62f4a375ff4 ("malloc: optimize 4K allocations")
> Cc: changfengnan@bytedance.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-19 11:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230519042923.314670-1-ruifeng.wang@arm.com>
2023-05-19  4:29 ` [PATCH 1/4] eal: fix list index for 256 byte element Ruifeng Wang
2023-05-19 11:10   ` Burakov, Anatoly
2023-05-19  4:29 ` [PATCH 3/4] test/malloc: fix missing free Ruifeng Wang
2023-05-19 11:08   ` Burakov, Anatoly
2023-05-19  4:29 ` [PATCH 4/4] test/malloc: fix case expectation Ruifeng Wang
2023-05-19 11:07   ` Burakov, Anatoly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).