* [PATCH] malloc: fix duplicate mem event notification @ 2018-11-29 14:21 Anatoly Burakov 2018-11-29 14:54 ` Wiles, Keith ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Anatoly Burakov @ 2018-11-29 14:21 UTC (permalink / raw) To: dev; +Cc: stable 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@dpdk.org Signed-off-by: Anatoly Burakov <anatoly.burakov@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; } unlock: -- 2.17.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] malloc: fix duplicate mem event notification 2018-11-29 14:21 [PATCH] malloc: fix duplicate mem event notification Anatoly Burakov @ 2018-11-29 14:54 ` Wiles, Keith 2018-11-29 15:36 ` Burakov, Anatoly 2018-11-29 15:36 ` Burakov, Anatoly 2018-12-11 16:48 ` [PATCH v2] " Anatoly Burakov 2 siblings, 1 reply; 8+ messages in thread From: Wiles, Keith @ 2018-11-29 14:54 UTC (permalink / raw) To: Burakov, Anatoly; +Cc: dpdk-dev, stable@dpdk.org > On Nov 29, 2018, at 8:21 AM, Anatoly Burakov <anatoly.burakov@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@dpdk.org > > Signed-off-by: Anatoly Burakov <anatoly.burakov@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; > unlock: > -- > 2.17.1 Regards, Keith ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] malloc: fix duplicate mem event notification 2018-11-29 14:54 ` Wiles, Keith @ 2018-11-29 15:36 ` Burakov, Anatoly 2018-11-29 15:47 ` Wiles, Keith 0 siblings, 1 reply; 8+ messages in thread From: Burakov, Anatoly @ 2018-11-29 15:36 UTC (permalink / raw) To: Wiles, Keith; +Cc: dpdk-dev, stable@dpdk.org On 29-Nov-18 2:54 PM, Wiles, Keith wrote: > > >> On Nov 29, 2018, at 8:21 AM, Anatoly Burakov <anatoly.burakov@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@dpdk.org >> >> Signed-off-by: Anatoly Burakov <anatoly.burakov@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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] malloc: fix duplicate mem event notification 2018-11-29 15:36 ` Burakov, Anatoly @ 2018-11-29 15:47 ` Wiles, Keith 2018-11-29 17:05 ` [dpdk-stable] " Ferruh Yigit 0 siblings, 1 reply; 8+ messages in thread From: Wiles, Keith @ 2018-11-29 15:47 UTC (permalink / raw) To: Burakov, Anatoly; +Cc: dpdk-dev, stable@dpdk.org > On Nov 29, 2018, at 9:36 AM, Burakov, Anatoly <anatoly.burakov@intel.com> wrote: > > On 29-Nov-18 2:54 PM, Wiles, Keith wrote: >>> On Nov 29, 2018, at 8:21 AM, Anatoly Burakov <anatoly.burakov@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@dpdk.org >>> >>> Signed-off-by: Anatoly Burakov <anatoly.burakov@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 :) Well it seems to be a very questionable formatting to leave the else with brackets in a single line style IMO. Also look at section 1.6.2 in DPDK coding style as it states something different. * Closing and opening braces go on the same line as the else keyword. * Braces that are not necessary should be left out. if (test) stmt; else if (bar) { stmt; stmt; } else stmt; Note the last else here. Looking at this code it appears check patch is wrong here compared to the DPDK coding style. > >>> unlock: >>> -- >>> 2.17.1 >> Regards, >> Keith > > > -- > Thanks, > Anatoly Regards, Keith ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-stable] [PATCH] malloc: fix duplicate mem event notification 2018-11-29 15:47 ` Wiles, Keith @ 2018-11-29 17:05 ` Ferruh Yigit 0 siblings, 0 replies; 8+ messages in thread From: Ferruh Yigit @ 2018-11-29 17:05 UTC (permalink / raw) To: Wiles, Keith, Burakov, Anatoly; +Cc: dpdk-dev, stable@dpdk.org On 11/29/2018 3:47 PM, Wiles, Keith wrote: > > >> On Nov 29, 2018, at 9:36 AM, Burakov, Anatoly <anatoly.burakov@intel.com> wrote: >> >> On 29-Nov-18 2:54 PM, Wiles, Keith wrote: >>>> On Nov 29, 2018, at 8:21 AM, Anatoly Burakov <anatoly.burakov@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@dpdk.org >>>> >>>> Signed-off-by: Anatoly Burakov <anatoly.burakov@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 :) > > Well it seems to be a very questionable formatting to leave the else with brackets in a single line style IMO. > > Also look at section 1.6.2 in DPDK coding style as it states something different. > > * Closing and opening braces go on the same line as the else keyword. > * Braces that are not necessary should be left out. > > if (test) > stmt; > else if (bar) { > stmt; > stmt; > } else > stmt; > > Note the last else here. Looking at this code it appears check patch is wrong here compared to the DPDK coding style. Yes we diverge a little there, Linux prefers if a leg of the branch has braces other legs should have it, we left out braces whenever we can. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] malloc: fix duplicate mem event notification 2018-11-29 14:21 [PATCH] malloc: fix duplicate mem event notification Anatoly Burakov 2018-11-29 14:54 ` Wiles, Keith @ 2018-11-29 15:36 ` Burakov, Anatoly 2018-12-11 16:48 ` [PATCH v2] " Anatoly Burakov 2 siblings, 0 replies; 8+ messages in thread From: Burakov, Anatoly @ 2018-11-29 15:36 UTC (permalink / raw) To: dev; +Cc: stable On 29-Nov-18 3:18 PM, Anatoly Burakov 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@dpdk.org > > Signed-off-by: Anatoly Burakov <anatoly.burakov@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; > } > unlock: > Oops, dupe. -- Thanks, Anatoly ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] malloc: fix duplicate mem event notification 2018-11-29 14:21 [PATCH] malloc: fix duplicate mem event notification Anatoly Burakov 2018-11-29 14:54 ` Wiles, Keith 2018-11-29 15:36 ` Burakov, Anatoly @ 2018-12-11 16:48 ` Anatoly Burakov 2018-12-20 14:29 ` [dpdk-stable] " Thomas Monjalon 2 siblings, 1 reply; 8+ messages in thread From: Anatoly Burakov @ 2018-12-11 16:48 UTC (permalink / raw) To: dev; +Cc: keith.wiles, stable 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@dpdk.org Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com> --- Notes: v2: - Fixed code style lib/librte_eal/common/rte_malloc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c index 0da5ad5e8..5f07b981a 100644 --- a/lib/librte_eal/common/rte_malloc.c +++ b/lib/librte_eal/common/rte_malloc.c @@ -517,13 +517,8 @@ sync_memory(const char *heap_name, void *va_addr, size_t len, bool attach) if (wa.result < 0) { 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); + } else ret = 0; - } unlock: rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock); return ret; -- 2.17.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [dpdk-stable] [PATCH v2] malloc: fix duplicate mem event notification 2018-12-11 16:48 ` [PATCH v2] " Anatoly Burakov @ 2018-12-20 14:29 ` Thomas Monjalon 0 siblings, 0 replies; 8+ messages in thread From: Thomas Monjalon @ 2018-12-20 14:29 UTC (permalink / raw) To: Anatoly Burakov; +Cc: stable, dev, keith.wiles 11/12/2018 17:48, Anatoly Burakov: > 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@dpdk.org > > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com> Applied, thanks ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-12-20 14:29 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-11-29 14:21 [PATCH] malloc: fix duplicate mem event notification Anatoly Burakov 2018-11-29 14:54 ` Wiles, Keith 2018-11-29 15:36 ` Burakov, Anatoly 2018-11-29 15:47 ` Wiles, Keith 2018-11-29 17:05 ` [dpdk-stable] " Ferruh Yigit 2018-11-29 15:36 ` Burakov, Anatoly 2018-12-11 16:48 ` [PATCH v2] " Anatoly Burakov 2018-12-20 14:29 ` [dpdk-stable] " Thomas Monjalon
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).