All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us,
	marcelo.leitner@gmail.com, vladbu@nvidia.com,
	Jiri Pirko <jiri@nvidia.com>
Subject: Re: [PATCH net-next v3 5/5] net/sched: cls_api: conditional notification of events
Date: Thu, 7 Dec 2023 20:59:39 +0000	[thread overview]
Message-ID: <20231207205939.GI50400@kernel.org> (raw)
In-Reply-To: <20231206164416.543503-6-pctammela@mojatatu.com>

On Wed, Dec 06, 2023 at 01:44:16PM -0300, Pedro Tammela wrote:
> As of today tc-filter/chain events are unconditionally built and sent to
> RTNLGRP_TC. As with the introduction of rtnl_notify_needed we can check
> before-hand if they are really needed. This will help to alleviate
> system pressure when filters are concurrently added without the rtnl
> lock as in tc-flower.
> 
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>

Thanks Pedro,

my comment below notwithstanding, this looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

> ---
>  net/sched/cls_api.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
> index 1976bd163986..123185907ebd 100644
> --- a/net/sched/cls_api.c
> +++ b/net/sched/cls_api.c
> @@ -2053,6 +2053,9 @@ static int tfilter_notify(struct net *net, struct sk_buff *oskb,
>  	u32 portid = oskb ? NETLINK_CB(oskb).portid : 0;
>  	int err = 0;
>  
> +	if (!unicast && !rtnl_notify_needed(net, n->nlmsg_flags, RTNLGRP_TC))

I don't feel strongly about this, but
as the above condition appears 3 times in this patch,
perhaps it could be a helper?

> +		return 0;
> +
>  	skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
>  	if (!skb)
>  		return -ENOBUFS;
> @@ -2082,6 +2085,9 @@ static int tfilter_del_notify(struct net *net, struct sk_buff *oskb,
>  	u32 portid = oskb ? NETLINK_CB(oskb).portid : 0;
>  	int err;
>  
> +	if (!unicast && !rtnl_notify_needed(net, n->nlmsg_flags, RTNLGRP_TC))
> +		return tp->ops->delete(tp, fh, last, rtnl_held, extack);
> +
>  	skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
>  	if (!skb)
>  		return -ENOBUFS;
> @@ -2906,6 +2912,9 @@ static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
>  	struct sk_buff *skb;
>  	int err = 0;
>  
> +	if (!unicast && !rtnl_notify_needed(net, flags, RTNLGRP_TC))
> +		return 0;
> +
>  	skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
>  	if (!skb)
>  		return -ENOBUFS;
> @@ -2935,6 +2944,9 @@ static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
>  	struct net *net = block->net;
>  	struct sk_buff *skb;
>  
> +	if (!unicast && !rtnl_notify_needed(net, flags, RTNLGRP_TC))
> +		return 0;
> +
>  	skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
>  	if (!skb)
>  		return -ENOBUFS;
> -- 
> 2.40.1
> 

  reply	other threads:[~2023-12-07 20:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 16:44 [PATCH net-next v3 0/5] net/sched: conditional notification of events for cls and act Pedro Tammela
2023-12-06 16:44 ` [PATCH net-next v3 1/5] rtnl: add helper to check if rtnl group has listeners Pedro Tammela
2023-12-07 20:59   ` Simon Horman
2023-12-06 16:44 ` [PATCH net-next v3 2/5] rtnl: add helper to check if a notification is needed Pedro Tammela
2023-12-07 21:00   ` Simon Horman
2023-12-06 16:44 ` [PATCH net-next v3 3/5] rtnl: add helper to send if skb is not null Pedro Tammela
2023-12-07 21:00   ` Simon Horman
2023-12-06 16:44 ` [PATCH net-next v3 4/5] net/sched: act_api: conditional notification of events Pedro Tammela
2023-12-07 20:56   ` Simon Horman
2023-12-08 14:21     ` Pedro Tammela
2023-12-08 10:09   ` Jiri Pirko
2023-12-06 16:44 ` [PATCH net-next v3 5/5] net/sched: cls_api: " Pedro Tammela
2023-12-07 20:59   ` Simon Horman [this message]
2023-12-08 17:48     ` 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=20231207205939.GI50400@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@nvidia.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pctammela@mojatatu.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.