netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: wenxu <wenxu@ucloud.cn>
To: Jakub Kicinski <kuba@kernel.org>
Cc: marcelo.leitner@gmail.com, vladbu@nvidia.com, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH v3 net-next 3/3] net/sched: sch_frag: add generic packet fragment support.
Date: Wed, 25 Nov 2020 07:10:43 +0800	[thread overview]
Message-ID: <e25b0a93-0fb1-60cf-9451-c82920c45076@ucloud.cn> (raw)
In-Reply-To: <20201124112430.64143482@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>


在 2020/11/25 3:24, Jakub Kicinski 写道:
> On Fri, 20 Nov 2020 07:38:36 +0800 wenxu@ucloud.cn wrote:
>> +int tcf_dev_queue_xmit(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb))
>> +{
>> +	xmit_hook_func *xmit_hook;
>> +
>> +	xmit_hook = rcu_dereference(tcf_xmit_hook);
>> +	if (xmit_hook)
>> +		return xmit_hook(skb, xmit);
>> +	else
>> +		return xmit(skb);
>> +}
>> +EXPORT_SYMBOL_GPL(tcf_dev_queue_xmit);
> I'm concerned about the performance impact of these indirect calls.
>
> Did you check what code compiler will generate? What the impact with
> retpolines enabled is going to be?
>
> Now that sch_frag is no longer a module this could be simplified.
>
> First of all - xmit_hook can only be sch_frag_xmit_hook, so please use
> that directly. 
>
> 	if (READ_ONCE(tcf_xmit_hook_count)) 
> 		sch_frag_xmit_hook(...
> 	else
> 		dev_queue_xmit(...
>
> The abstraction is costly and not necessary right now IMO.
>
> Then probably the counter should be:
>
> 	u32 __read_mostly tcf_xmit_hook_count;
>
> To avoid byte loads and having it be places in an unlucky cache line.
Maybe a static key replace  tcf_xmit_hook_count is more simplified?

DEFINE_STATIC_KEY_FALSE(tcf_xmit_hook_in_use);


  reply	other threads:[~2020-11-24 23:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 23:38 [PATCH v3 net-next 0/3] net/sched: fix over mtu packet of defrag in wenxu
2020-11-19 23:38 ` [PATCH v3 net-next 1/3] net/sched: fix miss init the mru in qdisc_skb_cb wenxu
2020-11-19 23:38 ` [PATCH v3 net-next 2/3] net/sched: act_mirred: refactor the handle of xmit wenxu
2020-11-19 23:38 ` [PATCH v3 net-next 3/3] net/sched: sch_frag: add generic packet fragment support wenxu
2020-11-24 19:24   ` Jakub Kicinski
2020-11-24 23:10     ` wenxu [this message]
2020-11-25  0:02       ` Jakub Kicinski
2020-11-20 19:28 ` [PATCH v3 net-next 0/3] net/sched: fix over mtu packet of defrag in Cong Wang
2020-11-21 14:39   ` Jamal Hadi Salim

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=e25b0a93-0fb1-60cf-9451-c82920c45076@ucloud.cn \
    --to=wenxu@ucloud.cn \
    --cc=jhs@mojatatu.com \
    --cc=kuba@kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vladbu@nvidia.com \
    --cc=xiyou.wangcong@gmail.com \
    /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).