[v2] app/test/test_distributor.c: prevent memory leakages from the pool
diff mbox series

Message ID 20200415064238.24012-1-sarosh.arif@emumba.com
State Superseded
Delegated to: David Marchand
Headers show
Series
  • [v2] app/test/test_distributor.c: prevent memory leakages from the pool
Related show

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation fail Compilation issues
ci/iol-intel-Performance fail Performance Testing issues
ci/travis-robot success Travis build: passed
ci/checkpatch success coding style OK

Commit Message

Sarosh Arif April 15, 2020, 6:42 a.m. UTC
v2:
remove double freeing of mbufs

Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
---
 app/test/test_distributor.c | 9 +++++++
 1 file changed, 7 insertions(+)


2.17.1

Comments

Lukasz Wojciechowski April 15, 2020, 6:52 a.m. UTC | #1
W dniu 15.04.2020 o 08:42, Sarosh Arif pisze:
> v2:
> remove double freeing of mbufs
>
> Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
> ---
>   app/test/test_distributor.c | 9 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
> index ba1f81cf8..5e972bb2e 100644
> --- a/app/test/test_distributor.c
> +++ b/app/test/test_distributor.c
> @@ -128,6 +128,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>   		printf("Line %d: Error, not all packets flushed. "
>   				"Expected %u, got %u\n",
>   				__LINE__, BURST, total_packet_count());
> +		rte_mempool_put_bulk(p, (void *)bufs, BURST);
>   		return -1;
>   	}
>   
> @@ -153,6 +154,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>   			printf("Line %d: Error, not all packets flushed. "
>   					"Expected %u, got %u\n",
>   					__LINE__, BURST, total_packet_count());
> +			rte_mempool_put_bulk(p, (void *)bufs, BURST);
>   			return -1;
>   		}
>   
> @@ -179,6 +181,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>   		printf("Line %d: Error, not all packets flushed. "
>   				"Expected %u, got %u\n",
>   				__LINE__, BURST, total_packet_count());
> +		rte_mempool_put_bulk(p, (void *)bufs, BURST);
>   		return -1;
>   	}
>   
> @@ -233,6 +236,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>   	if (num_returned != BIG_BATCH) {
>   		printf("line %d: Missing packets, expected %d\n",
>   				__LINE__, num_returned);
> +		rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
>   		return -1;
>   	}
>   
> @@ -247,6 +251,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>   
>   		if (j == BIG_BATCH) {
>   			printf("Error: could not find source packet #%u\n", i);
> +			rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
>   			return -1;
>   		}
>   	}
>
> 2.17.1
>
The sanity_test is ok now and does not have any mempool leaks.

What about other tests in this file: Do you plan to work on them also?
Sarosh Arif April 15, 2020, 7:06 a.m. UTC | #2
Yes, I plan to work on them when I get time.

On Wed, Apr 15, 2020 at 11:52 AM Lukasz Wojciechowski <
l.wojciechow@partner.samsung.com> wrote:

>
> W dniu 15.04.2020 o 08:42, Sarosh Arif pisze:
> > v2:
> > remove double freeing of mbufs
> >
> > Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
> > ---
> >   app/test/test_distributor.c | 9 +++++++
> >   1 file changed, 7 insertions(+)
> >
> > diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
> > index ba1f81cf8..5e972bb2e 100644
> > --- a/app/test/test_distributor.c
> > +++ b/app/test/test_distributor.c
> > @@ -128,6 +128,7 @@ sanity_test(struct worker_params *wp, struct
> rte_mempool *p)
> >               printf("Line %d: Error, not all packets flushed. "
> >                               "Expected %u, got %u\n",
> >                               __LINE__, BURST, total_packet_count());
> > +             rte_mempool_put_bulk(p, (void *)bufs, BURST);
> >               return -1;
> >       }
> >
> > @@ -153,6 +154,7 @@ sanity_test(struct worker_params *wp, struct
> rte_mempool *p)
> >                       printf("Line %d: Error, not all packets flushed. "
> >                                       "Expected %u, got %u\n",
> >                                       __LINE__, BURST,
> total_packet_count());
> > +                     rte_mempool_put_bulk(p, (void *)bufs, BURST);
> >                       return -1;
> >               }
> >
> > @@ -179,6 +181,7 @@ sanity_test(struct worker_params *wp, struct
> rte_mempool *p)
> >               printf("Line %d: Error, not all packets flushed. "
> >                               "Expected %u, got %u\n",
> >                               __LINE__, BURST, total_packet_count());
> > +             rte_mempool_put_bulk(p, (void *)bufs, BURST);
> >               return -1;
> >       }
> >
> > @@ -233,6 +236,7 @@ sanity_test(struct worker_params *wp, struct
> rte_mempool *p)
> >       if (num_returned != BIG_BATCH) {
> >               printf("line %d: Missing packets, expected %d\n",
> >                               __LINE__, num_returned);
> > +             rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
> >               return -1;
> >       }
> >
> > @@ -247,6 +251,7 @@ sanity_test(struct worker_params *wp, struct
> rte_mempool *p)
> >
> >               if (j == BIG_BATCH) {
> >                       printf("Error: could not find source packet
> #%u\n", i);
> > +                     rte_mempool_put_bulk(p, (void *)many_bufs,
> BIG_BATCH);
> >                       return -1;
> >               }
> >       }
> >
> > 2.17.1
> >
> The sanity_test is ok now and does not have any mempool leaks.
>
> What about other tests in this file: Do you plan to work on them also?
>
> --
>
> Lukasz Wojciechowski
> Principal Software Engineer
>
> Samsung R&D Institute Poland
> Samsung Electronics
> Office +48 22 377 88 25
> l.wojciechow@partner.samsung.com
>
>
Lukasz Wojciechowski April 15, 2020, 7:08 a.m. UTC | #3
W dniu 15.04.2020 o 09:06, Sarosh Arif pisze:
> Yes, I plan to work on them when I get time.
Great, please add me to CC. I would be glad to review it.
>
> On Wed, Apr 15, 2020 at 11:52 AM Lukasz Wojciechowski 
> <l.wojciechow@partner.samsung.com 
> <mailto:l.wojciechow@partner.samsung.com>> wrote:
>
>
>     W dniu 15.04.2020 o 08:42, Sarosh Arif pisze:
>     > v2:
>     > remove double freeing of mbufs
>     >
>     > Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com
>     <mailto:sarosh.arif@emumba.com>>
>     > ---
>     >   app/test/test_distributor.c | 9 +++++++
>     >   1 file changed, 7 insertions(+)
>     >
>     > diff --git a/app/test/test_distributor.c
>     b/app/test/test_distributor.c
>     > index ba1f81cf8..5e972bb2e 100644
>     > --- a/app/test/test_distributor.c
>     > +++ b/app/test/test_distributor.c
>     > @@ -128,6 +128,7 @@ sanity_test(struct worker_params *wp, struct
>     rte_mempool *p)
>     >               printf("Line %d: Error, not all packets flushed. "
>     >                               "Expected %u, got %u\n",
>     >                               __LINE__, BURST,
>     total_packet_count());
>     > +             rte_mempool_put_bulk(p, (void *)bufs, BURST);
>     >               return -1;
>     >       }
>     >
>     > @@ -153,6 +154,7 @@ sanity_test(struct worker_params *wp, struct
>     rte_mempool *p)
>     >                       printf("Line %d: Error, not all packets
>     flushed. "
>     >                                       "Expected %u, got %u\n",
>     >                                       __LINE__, BURST,
>     total_packet_count());
>     > +                     rte_mempool_put_bulk(p, (void *)bufs, BURST);
>     >                       return -1;
>     >               }
>     >
>     > @@ -179,6 +181,7 @@ sanity_test(struct worker_params *wp, struct
>     rte_mempool *p)
>     >               printf("Line %d: Error, not all packets flushed. "
>     >                               "Expected %u, got %u\n",
>     >                               __LINE__, BURST,
>     total_packet_count());
>     > +             rte_mempool_put_bulk(p, (void *)bufs, BURST);
>     >               return -1;
>     >       }
>     >
>     > @@ -233,6 +236,7 @@ sanity_test(struct worker_params *wp, struct
>     rte_mempool *p)
>     >       if (num_returned != BIG_BATCH) {
>     >               printf("line %d: Missing packets, expected %d\n",
>     >                               __LINE__, num_returned);
>     > +             rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
>     >               return -1;
>     >       }
>     >
>     > @@ -247,6 +251,7 @@ sanity_test(struct worker_params *wp, struct
>     rte_mempool *p)
>     >
>     >               if (j == BIG_BATCH) {
>     >                       printf("Error: could not find source
>     packet #%u\n", i);
>     > +                     rte_mempool_put_bulk(p, (void *)many_bufs,
>     BIG_BATCH);
>     >                       return -1;
>     >               }
>     >       }
>     >
>     > 2.17.1
>     >
>     The sanity_test is ok now and does not have any mempool leaks.
>
>     What about other tests in this file: Do you plan to work on them also?
>
>     -- 
>
>     Lukasz Wojciechowski
>     Principal Software Engineer
>
>     Samsung R&D Institute Poland
>     Samsung Electronics
>     Office +48 22 377 88 25
>     l.wojciechow@partner.samsung.com
>     <mailto:l.wojciechow@partner.samsung.com>
>
Sarosh Arif June 24, 2020, 10:02 a.m. UTC | #4
Some tests are failing on this patch but I don't think the reason
behind the failure is this patch. Is there a certain way to know that
the problem is in the patch or somewhere else?


On Wed, Jun 24, 2020 at 2:04 PM Sarosh Arif <sarosh.arif@emumba.com> wrote:
>
> Some tests are failing on this patch but I don't think the reason behind the failure is this patch. Is there a certain way to know that the problem is in the patch or somewhere else?
>
> On Wed, Apr 15, 2020 at 12:20 PM Sarosh Arif <sarosh.arif@emumba.com> wrote:
>>
>> Sure, will do that.
>>
>> On Wed, Apr 15, 2020 at 12:08 PM Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> wrote:
>>>
>>>
>>> W dniu 15.04.2020 o 09:06, Sarosh Arif pisze:
>>>
>>> Yes, I plan to work on them when I get time.
>>>
>>> Great, please add me to CC. I would be glad to review it.
>>>
>>>
>>> On Wed, Apr 15, 2020 at 11:52 AM Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> wrote:
>>>>
>>>>
>>>> W dniu 15.04.2020 o 08:42, Sarosh Arif pisze:
>>>> > v2:
>>>> > remove double freeing of mbufs
>>>> >
>>>> > Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
>>>> > ---
>>>> >   app/test/test_distributor.c | 9 +++++++
>>>> >   1 file changed, 7 insertions(+)
>>>> >
>>>> > diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
>>>> > index ba1f81cf8..5e972bb2e 100644
>>>> > --- a/app/test/test_distributor.c
>>>> > +++ b/app/test/test_distributor.c
>>>> > @@ -128,6 +128,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>> >               printf("Line %d: Error, not all packets flushed. "
>>>> >                               "Expected %u, got %u\n",
>>>> >                               __LINE__, BURST, total_packet_count());
>>>> > +             rte_mempool_put_bulk(p, (void *)bufs, BURST);
>>>> >               return -1;
>>>> >       }
>>>> >
>>>> > @@ -153,6 +154,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>> >                       printf("Line %d: Error, not all packets flushed. "
>>>> >                                       "Expected %u, got %u\n",
>>>> >                                       __LINE__, BURST, total_packet_count());
>>>> > +                     rte_mempool_put_bulk(p, (void *)bufs, BURST);
>>>> >                       return -1;
>>>> >               }
>>>> >
>>>> > @@ -179,6 +181,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>> >               printf("Line %d: Error, not all packets flushed. "
>>>> >                               "Expected %u, got %u\n",
>>>> >                               __LINE__, BURST, total_packet_count());
>>>> > +             rte_mempool_put_bulk(p, (void *)bufs, BURST);
>>>> >               return -1;
>>>> >       }
>>>> >
>>>> > @@ -233,6 +236,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>> >       if (num_returned != BIG_BATCH) {
>>>> >               printf("line %d: Missing packets, expected %d\n",
>>>> >                               __LINE__, num_returned);
>>>> > +             rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
>>>> >               return -1;
>>>> >       }
>>>> >
>>>> > @@ -247,6 +251,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>> >
>>>> >               if (j == BIG_BATCH) {
>>>> >                       printf("Error: could not find source packet #%u\n", i);
>>>> > +                     rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
>>>> >                       return -1;
>>>> >               }
>>>> >       }
>>>> >
>>>> > 2.17.1
>>>> >
>>>> The sanity_test is ok now and does not have any mempool leaks.
>>>>
>>>> What about other tests in this file: Do you plan to work on them also?
>>>>
>>>> --
>>>>
>>>> Lukasz Wojciechowski
>>>> Principal Software Engineer
>>>>
>>>> Samsung R&D Institute Poland
>>>> Samsung Electronics
>>>> Office +48 22 377 88 25
>>>> l.wojciechow@partner.samsung.com
>>>>
>>> --
>>>
>>> Lukasz Wojciechowski
>>> Principal Software Engineer
>>>
>>> Samsung R&D Institute Poland
>>> Samsung Electronics
>>> Office +48 22 377 88 25
>>> l.wojciechow@partner.samsung.com
>>>
>>>
>>>
>>>
Lukasz Wojciechowski Sept. 1, 2020, 6:31 p.m. UTC | #5
Sarosh,

I cherry picked your patch on current main branch and it works and 
builds without problems,

maybe try resubmitting it as v3.

Best regards

Lukasz

W dniu 24.06.2020 o 12:02, Sarosh Arif pisze:
> Some tests are failing on this patch but I don't think the reason
> behind the failure is this patch. Is there a certain way to know that
> the problem is in the patch or somewhere else?
>
>
> On Wed, Jun 24, 2020 at 2:04 PM Sarosh Arif <sarosh.arif@emumba.com> wrote:
>> Some tests are failing on this patch but I don't think the reason behind the failure is this patch. Is there a certain way to know that the problem is in the patch or somewhere else?
>>
>> On Wed, Apr 15, 2020 at 12:20 PM Sarosh Arif <sarosh.arif@emumba.com> wrote:
>>> Sure, will do that.
>>>
>>> On Wed, Apr 15, 2020 at 12:08 PM Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> wrote:
>>>>
>>>> W dniu 15.04.2020 o 09:06, Sarosh Arif pisze:
>>>>
>>>> Yes, I plan to work on them when I get time.
>>>>
>>>> Great, please add me to CC. I would be glad to review it.
>>>>
>>>>
>>>> On Wed, Apr 15, 2020 at 11:52 AM Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> wrote:
>>>>>
>>>>> W dniu 15.04.2020 o 08:42, Sarosh Arif pisze:
>>>>>> v2:
>>>>>> remove double freeing of mbufs
>>>>>>
>>>>>> Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
>>>>>> ---
>>>>>>    app/test/test_distributor.c | 9 +++++++
>>>>>>    1 file changed, 7 insertions(+)
>>>>>>
>>>>>> diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
>>>>>> index ba1f81cf8..5e972bb2e 100644
>>>>>> --- a/app/test/test_distributor.c
>>>>>> +++ b/app/test/test_distributor.c
>>>>>> @@ -128,6 +128,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>>>>                printf("Line %d: Error, not all packets flushed. "
>>>>>>                                "Expected %u, got %u\n",
>>>>>>                                __LINE__, BURST, total_packet_count());
>>>>>> +             rte_mempool_put_bulk(p, (void *)bufs, BURST);
>>>>>>                return -1;
>>>>>>        }
>>>>>>
>>>>>> @@ -153,6 +154,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>>>>                        printf("Line %d: Error, not all packets flushed. "
>>>>>>                                        "Expected %u, got %u\n",
>>>>>>                                        __LINE__, BURST, total_packet_count());
>>>>>> +                     rte_mempool_put_bulk(p, (void *)bufs, BURST);
>>>>>>                        return -1;
>>>>>>                }
>>>>>>
>>>>>> @@ -179,6 +181,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>>>>                printf("Line %d: Error, not all packets flushed. "
>>>>>>                                "Expected %u, got %u\n",
>>>>>>                                __LINE__, BURST, total_packet_count());
>>>>>> +             rte_mempool_put_bulk(p, (void *)bufs, BURST);
>>>>>>                return -1;
>>>>>>        }
>>>>>>
>>>>>> @@ -233,6 +236,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>>>>        if (num_returned != BIG_BATCH) {
>>>>>>                printf("line %d: Missing packets, expected %d\n",
>>>>>>                                __LINE__, num_returned);
>>>>>> +             rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
>>>>>>                return -1;
>>>>>>        }
>>>>>>
>>>>>> @@ -247,6 +251,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
>>>>>>
>>>>>>                if (j == BIG_BATCH) {
>>>>>>                        printf("Error: could not find source packet #%u\n", i);
>>>>>> +                     rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
>>>>>>                        return -1;
>>>>>>                }
>>>>>>        }
>>>>>>
>>>>>> 2.17.1
>>>>>>
>>>>> The sanity_test is ok now and does not have any mempool leaks.
>>>>>
>>>>> What about other tests in this file: Do you plan to work on them also?
>>>>>
>>>>> --
>>>>>
>>>>> Lukasz Wojciechowski
>>>>> Principal Software Engineer
>>>>>
>>>>> Samsung R&D Institute Poland
>>>>> Samsung Electronics
>>>>> Office +48 22 377 88 25
>>>>> l.wojciechow@partner.samsung.com
>>>>>
>>>> --
>>>>
>>>> Lukasz Wojciechowski
>>>> Principal Software Engineer
>>>>
>>>> Samsung R&D Institute Poland
>>>> Samsung Electronics
>>>> Office +48 22 377 88 25
>>>> l.wojciechow@partner.samsung.com
>>>>
>>>>
>>>>
>>>>

Patch
diff mbox series

diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index ba1f81cf8..5e972bb2e 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -128,6 +128,7 @@  sanity_test(struct worker_params *wp, struct rte_mempool *p)
 		printf("Line %d: Error, not all packets flushed. "
 				"Expected %u, got %u\n",
 				__LINE__, BURST, total_packet_count());
+		rte_mempool_put_bulk(p, (void *)bufs, BURST);
 		return -1;
 	}
 
@@ -153,6 +154,7 @@  sanity_test(struct worker_params *wp, struct rte_mempool *p)
 			printf("Line %d: Error, not all packets flushed. "
 					"Expected %u, got %u\n",
 					__LINE__, BURST, total_packet_count());
+			rte_mempool_put_bulk(p, (void *)bufs, BURST);
 			return -1;
 		}
 
@@ -179,6 +181,7 @@  sanity_test(struct worker_params *wp, struct rte_mempool *p)
 		printf("Line %d: Error, not all packets flushed. "
 				"Expected %u, got %u\n",
 				__LINE__, BURST, total_packet_count());
+		rte_mempool_put_bulk(p, (void *)bufs, BURST);
 		return -1;
 	}
 
@@ -233,6 +236,7 @@  sanity_test(struct worker_params *wp, struct rte_mempool *p)
 	if (num_returned != BIG_BATCH) {
 		printf("line %d: Missing packets, expected %d\n",
 				__LINE__, num_returned);
+		rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
 		return -1;
 	}
 
@@ -247,6 +251,7 @@  sanity_test(struct worker_params *wp, struct rte_mempool *p)
 
 		if (j == BIG_BATCH) {
 			printf("Error: could not find source packet #%u\n", i);
+			rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
 			return -1;
 		}
 	}