[dpdk-dev] [PATCH] malloc: fix duplicate mem event notification

Burakov, Anatoly anatoly.burakov at intel.com
Thu Nov 29 16:36:29 CET 2018


On 29-Nov-18 2:54 PM, Wiles, Keith wrote:
> 
> 
>> On Nov 29, 2018, at 8:21 AM, Anatoly Burakov <anatoly.burakov at intel.com> wrote:
>>
>> We already trigger a mem event notification inside the walk function,
>> no need to do it twice.
>>
>> Fixes: f32c7c9de961 ("malloc: enable event callbacks for external memory")
>> Cc: stable at dpdk.org
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
>> ---
>> lib/librte_eal/common/rte_malloc.c | 4 ----
>> 1 file changed, 4 deletions(-)
>>
>> diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
>> index 0da5ad5e8..750a83c2c 100644
>> --- a/lib/librte_eal/common/rte_malloc.c
>> +++ b/lib/librte_eal/common/rte_malloc.c
>> @@ -518,10 +518,6 @@ sync_memory(const char *heap_name, void *va_addr, size_t len, bool attach)
>> 		rte_errno = -wa.result;
>> 		ret = -1;
>> 	} else {
>> -		/* notify all subscribers that a new memory area was added */
>> -		if (attach)
>> -			eal_memalloc_mem_event_notify(RTE_MEM_EVENT_ALLOC,
>> -					va_addr, len);
>> 		ret = 0;
>> 	}
> 
> This change leaves
> 	else {
> 		ret = 0;
> 	}
> 
> Needs to be:
> 	else
> 		ret = 0;
> 

Checkpatch disagrees :P Brackets are needed everywhere if at least one 
of the branches is a multiline branch. No brackets needed only if all 
branches are one-line branches.

As a side note, I would also argue that we shouldn't leave bracket-less 
if statements altogether, because it makes for extra effort whenever a 
single-line statement inevitably becomes a multiline one (e.g. could be 
as simple as putting in a debug printf - i now have to add brackets 
everywhere...). But that's a topic for another day :)

> 
>> unlock:
>> -- 
>> 2.17.1
> 
> Regards,
> Keith
> 
> 


-- 
Thanks,
Anatoly


More information about the dev mailing list