[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9k8seDdoS1LHB7L@corigine.com>
Date: Tue, 31 Jan 2023 17:07:13 +0100
From: Simon Horman <simon.horman@...igine.com>
To: Pedro Tammela <pctammela@...atatu.com>
Cc: netdev@...r.kernel.org, jhs@...atatu.com, xiyou.wangcong@...il.com,
jiri@...nulli.us, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com
Subject: Re: [PATCH net-next v5 1/2] net/sched: transition act_pedit to rcu
and percpu stats
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@...atatu.com>
> Signed-off-by: Pedro Tammela <pctammela@...atatu.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?
...
Powered by blists - more mailing lists