DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold
@ 2019-05-20 22:52 Stephen Hemminger
  2019-05-21  8:01 ` Van Haaren, Harry
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2019-05-20 22:52 UTC (permalink / raw)
  To: adrien.mazarguil; +Cc: dev, Stephen Hemminger

A minor optimization that save a few cycles during flow setup.

Use the GCC cold attribute for the rte_flow_error_set function.
This attribute implicitly marks all code paths that arrive at
this function as unlikely.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_ethdev/rte_flow.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 63f84fca65c4..dc821be43f19 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -2591,7 +2591,13 @@ rte_flow_error_set(struct rte_flow_error *error,
 		   int code,
 		   enum rte_flow_error_type type,
 		   const void *cause,
-		   const char *message);
+		   const char *message)
+#ifdef __GNUC__
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2))
+	__attribute__((cold))
+#endif
+#endif
+	;
 
 /**
  * @deprecated
-- 
2.20.1


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

* Re: [dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold
  2019-05-20 22:52 [dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold Stephen Hemminger
@ 2019-05-21  8:01 ` Van Haaren, Harry
  2019-05-21 14:31   ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Van Haaren, Harry @ 2019-05-21  8:01 UTC (permalink / raw)
  To: Stephen Hemminger, adrien.mazarguil; +Cc: dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Monday, May 20, 2019 11:52 PM
> To: adrien.mazarguil@6wind.com
> Cc: dev@dpdk.org; Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold
> 
> A minor optimization that save a few cycles during flow setup.
> 
> Use the GCC cold attribute for the rte_flow_error_set function.
> This attribute implicitly marks all code paths that arrive at
> this function as unlikely.

Interesting - wasn't aware this is what the "cold" attribute does.


>  lib/librte_ethdev/rte_flow.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 63f84fca65c4..dc821be43f19 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -2591,7 +2591,13 @@ rte_flow_error_set(struct rte_flow_error *error,
>  		   int code,
>  		   enum rte_flow_error_type type,
>  		   const void *cause,
> -		   const char *message);
> +		   const char *message)
> +#ifdef __GNUC__
> +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2))
> +	__attribute__((cold))
> +#endif
> +#endif
> +	;


Would it be worth making an  __rte_attribute_cold  or similar?
Less in-place #ifdefs and there are probably other locations in
DPDK that would also benefit from such an annotation.

-Harry

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

* Re: [dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold
  2019-05-21  8:01 ` Van Haaren, Harry
@ 2019-05-21 14:31   ` Stephen Hemminger
  2019-05-21 15:32     ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2019-05-21 14:31 UTC (permalink / raw)
  To: Van Haaren, Harry; +Cc: adrien.mazarguil, dev

On Tue, 21 May 2019 08:01:53 +0000
"Van Haaren, Harry" <harry.van.haaren@intel.com> wrote:

> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> > Sent: Monday, May 20, 2019 11:52 PM
> > To: adrien.mazarguil@6wind.com
> > Cc: dev@dpdk.org; Stephen Hemminger <stephen@networkplumber.org>
> > Subject: [dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold
> > 
> > A minor optimization that save a few cycles during flow setup.
> > 
> > Use the GCC cold attribute for the rte_flow_error_set function.
> > This attribute implicitly marks all code paths that arrive at
> > this function as unlikely.  
> 
> Interesting - wasn't aware this is what the "cold" attribute does.
> 
> 
> >  lib/librte_ethdev/rte_flow.h | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> > index 63f84fca65c4..dc821be43f19 100644
> > --- a/lib/librte_ethdev/rte_flow.h
> > +++ b/lib/librte_ethdev/rte_flow.h
> > @@ -2591,7 +2591,13 @@ rte_flow_error_set(struct rte_flow_error *error,
> >  		   int code,
> >  		   enum rte_flow_error_type type,
> >  		   const void *cause,
> > -		   const char *message);
> > +		   const char *message)
> > +#ifdef __GNUC__
> > +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2))
> > +	__attribute__((cold))
> > +#endif
> > +#endif
> > +	;  
> 
> 
> Would it be worth making an  __rte_attribute_cold  or similar?
> Less in-place #ifdefs and there are probably other locations in
> DPDK that would also benefit from such an annotation.
> 
> -Harry

I just cloned what was already on rte_log.

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

* Re: [dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold
  2019-05-21 14:31   ` Stephen Hemminger
@ 2019-05-21 15:32     ` Ferruh Yigit
  0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2019-05-21 15:32 UTC (permalink / raw)
  To: Stephen Hemminger, Van Haaren, Harry; +Cc: adrien.mazarguil, dev

On 5/21/2019 3:31 PM, Stephen Hemminger wrote:
> On Tue, 21 May 2019 08:01:53 +0000
> "Van Haaren, Harry" <harry.van.haaren@intel.com> wrote:
> 
>>> -----Original Message-----
>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
>>> Sent: Monday, May 20, 2019 11:52 PM
>>> To: adrien.mazarguil@6wind.com
>>> Cc: dev@dpdk.org; Stephen Hemminger <stephen@networkplumber.org>
>>> Subject: [dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold
>>>
>>> A minor optimization that save a few cycles during flow setup.
>>>
>>> Use the GCC cold attribute for the rte_flow_error_set function.
>>> This attribute implicitly marks all code paths that arrive at
>>> this function as unlikely.  
>>
>> Interesting - wasn't aware this is what the "cold" attribute does.
>>
>>
>>>  lib/librte_ethdev/rte_flow.h | 8 +++++++-
>>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
>>> index 63f84fca65c4..dc821be43f19 100644
>>> --- a/lib/librte_ethdev/rte_flow.h
>>> +++ b/lib/librte_ethdev/rte_flow.h
>>> @@ -2591,7 +2591,13 @@ rte_flow_error_set(struct rte_flow_error *error,
>>>  		   int code,
>>>  		   enum rte_flow_error_type type,
>>>  		   const void *cause,
>>> -		   const char *message);
>>> +		   const char *message)
>>> +#ifdef __GNUC__
>>> +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2))
>>> +	__attribute__((cold))
>>> +#endif
>>> +#endif
>>> +	;  
>>
>>
>> Would it be worth making an  __rte_attribute_cold  or similar?
>> Less in-place #ifdefs and there are probably other locations in
>> DPDK that would also benefit from such an annotation.

+1 to define '__rte_cold' [1] in 'lib/librte_eal/common/include/rte_common.h'
as defined other similar compiler attributes there.

[1]
or '__rte_attribute_cold' but all other attribute defines are missing
'attribute' keyword, so I think can be skipped here as well

>>
>> -Harry
> 
> I just cloned what was already on rte_log.
> 


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

end of thread, other threads:[~2019-05-21 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 22:52 [dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold Stephen Hemminger
2019-05-21  8:01 ` Van Haaren, Harry
2019-05-21 14:31   ` Stephen Hemminger
2019-05-21 15:32     ` Ferruh Yigit

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).