bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Leesoo Ahn <dev@ooseel.net>
Cc: brouer@redhat.com, lsahn@ooseel.net,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: xdp: Give compiler __always_inline hint for xdp_rxq_info_init()
Date: Tue, 1 Dec 2020 17:09:19 +0100	[thread overview]
Message-ID: <20201201170919.08934eed@carbon> (raw)
In-Reply-To: <20201130114825.10898-1-lsahn@ooseel.net>

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


      reply	other threads:[~2020-12-01 16:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201201170919.08934eed@carbon \
    --to=brouer@redhat.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dev@ooseel.net \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsahn@ooseel.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).