From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Vlad Buslov <vladbu@mellanox.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, jiri@resnulli.us, pablo@netfilter.org,
kadlec@blackhole.kfki.hu, fw@strlen.de, ast@kernel.org,
daniel@iogearbox.net, edumazet@google.com, keescook@chromium.org
Subject: Re: [PATCH net-next 13/14] net: core: add new/replace rate estimator lock parameter
Date: Wed, 8 Aug 2018 11:18:17 -0300 [thread overview]
Message-ID: <20180808141815.GF14666@localhost.localdomain> (raw)
In-Reply-To: <vbfo9ed2g7i.fsf@reg-r-vrt-018-180.mtr.labs.mlnx>
On Wed, Aug 08, 2018 at 03:30:41PM +0300, Vlad Buslov wrote:
> On Wed 08 Aug 2018 at 01:37, Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> wrote:
> > On Mon, Aug 06, 2018 at 09:54:24AM +0300, Vlad Buslov wrote:
> >> Extend rate estimator 'new' and 'replace' APIs with additional spinlock
> >> parameter to be used by rtnl-unlocked actions to protect rate_est pointer
> >> from concurrent modification.
> >
> > I'm wondering if this additional parameter is really needed. So far,
> > the only case in which it is not NULL, the same lock that is used to
> > protect the stats is also used in this new parameter.
> >
> > ...
> >
> >> --- a/net/sched/act_police.c
> >> +++ b/net/sched/act_police.c
> >> @@ -138,7 +138,7 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla,
> >>
> >> if (est) {
> >> err = gen_replace_estimator(&police->tcf_bstats, NULL,
> >> - &police->tcf_rate_est,
> >> + &police->tcf_rate_est, NULL,
> >> &police->tcf_lock,
> >> NULL, est);
> >
> > Which is here, and this new NULL arg is replaced by &police->tcf_lock
> > in the next patch.
> >
> > Do you foresee a case in which a different lock will be used?
>
> Not in my use-case, no.
>
> > Or maybe it is because the current one is explicitly aimed towards the
> > stats?
>
> Yes, stats lock is only taken when fetching counters. You think better
> approach would be to rely on the fact that, in case of police action,
> same lock is already passed as stats lock? Having it as standalone
And the fact that we have no foreseeable user of two different locks.
> argument looked like cleaner approach to me. If you think this change is
> too much code for very little benefit, I can reuse stats lock.
That's my current thinking, yes. Especially considering the amount of
parameters this function already has, I would refrain from adding yet
another unless really needed.
Maybe s/stats_lock/lock/ in function parameter (struct member doesn't
need to be changed) and doctext:
* @lock: lock for statistics and control path.
wdyt?
>
> >
> > Marcelo
>
> Thank you for reviewing my code!
next prev parent reply other threads:[~2018-08-08 16:38 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-06 6:54 [PATCH net-next 00/14] Remove rtnl lock dependency from all action implementations Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 01/14] net: sched: act_bpf: remove dependency on rtnl lock Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 02/14] net: sched: act_csum: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 03/14] net: sched: act_gact: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 04/14] net: sched: act_ife: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 05/14] net: sched: act_ipt: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 06/14] net: sched: act_pedit: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 07/14] net: sched: act_sample: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 08/14] net: sched: act_simple: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 09/14] net: sched: act_skbmod: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 10/14] net: sched: act_tunnel_key: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 11/14] net: sched: act_vlan: " Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 12/14] net: sched: act_mirred: " Vlad Buslov
2018-08-07 16:36 ` Jiri Pirko
2018-08-08 7:40 ` Vlad Buslov
2018-08-08 8:03 ` Jiri Pirko
2018-08-08 8:47 ` Vlad Buslov
2018-08-08 8:54 ` Jiri Pirko
2018-08-08 11:21 ` Vlad Buslov
2018-08-06 6:54 ` [PATCH net-next 13/14] net: core: add new/replace rate estimator lock parameter Vlad Buslov
2018-08-08 1:37 ` Marcelo Ricardo Leitner
2018-08-08 12:30 ` Vlad Buslov
2018-08-08 14:18 ` Marcelo Ricardo Leitner [this message]
2018-08-06 6:54 ` [PATCH net-next 14/14] net: sched: act_police: remove dependency on rtnl lock Vlad Buslov
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=20180808141815.GF14666@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kadlec@blackhole.kfki.hu \
--cc=keescook@chromium.org \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=vladbu@mellanox.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).