From: Paolo Abeni <pabeni@redhat.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [RFC PATCH] net_sched: bulk free tcf_block
Date: Fri, 01 Dec 2017 12:05:07 +0100 [thread overview]
Message-ID: <1512126307.3155.26.camel@redhat.com> (raw)
In-Reply-To: <CAM_iQpWt5B0q5GE_gs-772H+dWUDJxJHG5vy-i6V9SyThyCihg@mail.gmail.com>
On Thu, 2017-11-30 at 23:14 -0800, Cong Wang wrote:
> On Wed, Nov 29, 2017 at 6:25 AM, Paolo Abeni <pabeni@redhat.com> wrote:
> > Currently deleting qdisc with a large number of children and filters
> > can take a lot of time:
> >
> > tc qdisc add dev lo root htb
> > for I in `seq 1 1000`; do
> > tc class add dev lo parent 1: classid 1:$I htb rate 100kbit
> > tc qdisc add dev lo parent 1:$I handle $((I + 1)): htb
> > for J in `seq 1 10`; do
> > tc filter add dev lo parent $((I + 1)): u32 match ip src 1.1.1.$J
> > done
> > done
> > time tc qdisc del dev root
> >
> > real 0m54.764s
> > user 0m0.023s
> > sys 0m0.000s
> >
> > This is due to the multiple rcu_barrier() calls, one for each tcf_block
> > freed, invoked with the rtnl lock held. Most other network related
> > tasks will block in this timespan.
>
> Yeah, Eric pointed out this too and I already had an idea to cure
> this.
>
> As I already mentioned before, my idea is to refcnt the tcf block
> so that we don't need to worry about which is the last. Something
> like the attached patch below, note it is PoC _only_, not even
> compiled yet. And I am not 100% sure it works either, I will look
> deeper tomorrow.
Thank you for the feedback.
I tested your patch and in the above scenario I measure:
real 0m0.017s
user 0m0.000s
sys 0m0.017s
so it apparently works well for this case.
We could still have a storm of rtnl lock/unlock operations while
deleting a large tc tree with lot of filters, and I think we can reduce
them with bulk free, evenutally applying it to filters, too.
That will also reduce the pressure on the rtnl lock when e.g. OVS H/W
offload pushes a lot of rules/sec.
WDYT?
Cheers,
Paolo
next prev parent reply other threads:[~2017-12-01 11:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 14:25 [RFC PATCH] net_sched: bulk free tcf_block Paolo Abeni
2017-11-29 16:14 ` Alexander Duyck
2017-11-29 18:47 ` Paolo Abeni
2017-12-01 7:14 ` Cong Wang
2017-12-01 11:05 ` Paolo Abeni [this message]
2017-12-01 22:07 ` Cong Wang
2017-12-04 10:12 ` Paolo Abeni
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=1512126307.3155.26.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--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.