bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: xdp: Give compiler __always_inline hint for xdp_rxq_info_init()
@ 2020-11-30 11:48 Leesoo Ahn
  2020-12-01 16:09 ` Jesper Dangaard Brouer
  0 siblings, 1 reply; 2+ messages in thread
From: Leesoo Ahn @ 2020-11-30 11:48 UTC (permalink / raw)
  To: lsahn
  Cc: David S. Miller, Jakub Kicinski, Alexei Starovoitov,
	Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend, netdev,
	bpf, linux-kernel

The function has only a statement of calling memset() to
clear xdp_rxq object. Let it always be an inline function.

Signed-off-by: Leesoo Ahn <lsahn@ooseel.net>
---
 net/core/xdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/xdp.c b/net/core/xdp.c
index 48aba933a5a8..dab72b9a71a1 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -151,7 +151,7 @@ void xdp_rxq_info_unreg(struct xdp_rxq_info *xdp_rxq)
 }
 EXPORT_SYMBOL_GPL(xdp_rxq_info_unreg);
 
-static void xdp_rxq_info_init(struct xdp_rxq_info *xdp_rxq)
+static __always_inline void xdp_rxq_info_init(struct xdp_rxq_info *xdp_rxq)
 {
 	memset(xdp_rxq, 0, sizeof(*xdp_rxq));
 }
-- 
2.26.2


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

* Re: [PATCH] net: xdp: Give compiler __always_inline hint for xdp_rxq_info_init()
  2020-11-30 11:48 [PATCH] net: xdp: Give compiler __always_inline hint for xdp_rxq_info_init() Leesoo Ahn
@ 2020-12-01 16:09 ` Jesper Dangaard Brouer
  0 siblings, 0 replies; 2+ messages in thread
From: Jesper Dangaard Brouer @ 2020-12-01 16:09 UTC (permalink / raw)
  To: Leesoo Ahn
  Cc: brouer, lsahn, David S. Miller, Jakub Kicinski,
	Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
	John Fastabend, netdev, bpf, linux-kernel

On Mon, 30 Nov 2020 20:48:25 +0900
Leesoo Ahn <dev@ooseel.net> wrote:

> The function has only a statement of calling memset() to
> clear xdp_rxq object. Let it always be an inline function.

No, this is the wrong approach.

The function is already "static", and the compiler have likely already
inlined this code, but we leave it up to the compiler to choose.
Besides this is slowpath code, why are you even trying to optimize this?

 
> Signed-off-by: Leesoo Ahn <lsahn@ooseel.net>
> ---
>  net/core/xdp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/xdp.c b/net/core/xdp.c
> index 48aba933a5a8..dab72b9a71a1 100644
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c
> @@ -151,7 +151,7 @@ void xdp_rxq_info_unreg(struct xdp_rxq_info *xdp_rxq)
>  }
>  EXPORT_SYMBOL_GPL(xdp_rxq_info_unreg);
>  
> -static void xdp_rxq_info_init(struct xdp_rxq_info *xdp_rxq)
> +static __always_inline void xdp_rxq_info_init(struct xdp_rxq_info *xdp_rxq)
>  {
>  	memset(xdp_rxq, 0, sizeof(*xdp_rxq));
>  }



-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer


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

end of thread, other threads:[~2020-12-01 16:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 11:48 [PATCH] net: xdp: Give compiler __always_inline hint for xdp_rxq_info_init() Leesoo Ahn
2020-12-01 16:09 ` Jesper Dangaard Brouer

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