[dpdk-dev] [PATCH] rte_flow: mark rte_flow_error_set as cold
Van Haaren, Harry
harry.van.haaren at intel.com
Tue May 21 10:01:53 CEST 2019
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Monday, May 20, 2019 11:52 PM
> To: adrien.mazarguil at 6wind.com
> Cc: dev at dpdk.org; Stephen Hemminger <stephen at 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
More information about the dev
mailing list