From: Simon Horman <simon.horman@corigine.com>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net-next v5 1/2] net/sched: transition act_pedit to rcu and percpu stats
Date: Tue, 31 Jan 2023 17:07:13 +0100 [thread overview]
Message-ID: <Y9k8seDdoS1LHB7L@corigine.com> (raw)
In-Reply-To: <20230131145149.3776656-2-pctammela@mojatatu.com>
On Tue, Jan 31, 2023 at 11:51:48AM -0300, Pedro Tammela wrote:
> The software pedit action didn't get the same love as some of the
> other actions and it's still using spinlocks and shared stats in the
> datapath.
> Transition the action to rcu and percpu stats as this improves the
> action's performance dramatically on multiple cpu deployments.
>
> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
...
> diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
> index a0378e9f0121..674b534be46e 100644
> --- a/net/sched/act_pedit.c
> +++ b/net/sched/act_pedit.c
...
> @@ -143,8 +154,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
> bool bind = flags & TCA_ACT_FLAGS_BIND;
> struct nlattr *tb[TCA_PEDIT_MAX + 1];
> struct tcf_chain *goto_ch = NULL;
> - struct tc_pedit_key *keys = NULL;
> - struct tcf_pedit_key_ex *keys_ex;
> + struct tcf_pedit_parms *oparms, *nparms;
nit: reverse xmas tree
> struct tc_pedit *parm;
> struct nlattr *pattr;
> struct tcf_pedit *p;
...
> @@ -212,48 +228,51 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
> ret = err;
> goto out_release;
> }
> - p = to_pedit(*a);
> - spin_lock_bh(&p->tcf_lock);
>
> - if (ret == ACT_P_CREATED ||
> - (p->tcfp_nkeys && p->tcfp_nkeys != parm->nkeys)) {
> - keys = kmalloc(ksize, GFP_ATOMIC);
> - if (!keys) {
> - spin_unlock_bh(&p->tcf_lock);
> - ret = -ENOMEM;
> - goto put_chain;
> - }
> - kfree(p->tcfp_keys);
> - p->tcfp_keys = keys;
> - p->tcfp_nkeys = parm->nkeys;
> + nparms->tcfp_off_max_hint = 0;
> + nparms->tcfp_flags = parm->flags;
> + nparms->tcfp_nkeys = parm->nkeys;
> +
> + nparms->tcfp_keys = kmalloc(ksize, GFP_KERNEL);
Can ksize be zero?
...
next prev parent reply other threads:[~2023-01-31 16:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 14:51 [PATCH net-next v5 0/2] net/sched: transition act_pedit to rcu and percpu stats Pedro Tammela
2023-01-31 14:51 ` [PATCH net-next v5 1/2] " Pedro Tammela
2023-01-31 16:07 ` Simon Horman [this message]
2023-01-31 19:05 ` Pedro Tammela
2023-02-01 13:12 ` Simon Horman
2023-01-31 14:51 ` [PATCH net-next v5 2/2] net/sched: simplify tcf_pedit_act Pedro Tammela
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=Y9k8seDdoS1LHB7L@corigine.com \
--to=simon.horman@corigine.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pctammela@mojatatu.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).