netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Chris Mi <chrism@mellanox.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jiri Pirko <jiri@resnulli.us>,
	John Fastabend <john.fastabend@gmail.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [Patch net 01/16] net_sched: introduce a workqueue for RCU callbacks of tc filter
Date: Fri, 27 Oct 2017 04:55:50 -0700	[thread overview]
Message-ID: <20171027115550.GG3659@linux.vnet.ibm.com> (raw)
In-Reply-To: <1509079166.11887.33.camel@edumazet-glaptop3.roam.corp.google.com>

On Thu, Oct 26, 2017 at 09:39:26PM -0700, Eric Dumazet wrote:
> On Thu, 2017-10-26 at 21:28 -0700, Cong Wang wrote:
> > On Thu, Oct 26, 2017 at 9:05 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > > On Thu, 2017-10-26 at 18:24 -0700, Cong Wang wrote:
> > >> ...
> > >
> > >> On the other hand, this makes tcf_block_put() ugly and
> > >> harder to understand. Since David and Eric strongly dislike
> > >> adding synchronize_rcu(), this is probably the only
> > >> solution that could make everyone happy.
> > >
> > >
> > > ...
> > >
> > >> +static void tcf_block_put_deferred(struct work_struct *work)
> > >> +{
> > >> +     struct tcf_block *block = container_of(work, struct tcf_block, work);
> > >> +     struct tcf_chain *chain;
> > >>
> > >> +     rtnl_lock();
> > >>       /* Hold a refcnt for all chains, except 0, in case they are gone. */
> > >>       list_for_each_entry(chain, &block->chain_list, list)
> > >>               if (chain->index)
> > >> @@ -292,13 +308,27 @@ void tcf_block_put(struct tcf_block *block)
> > >>       list_for_each_entry(chain, &block->chain_list, list)
> > >>               tcf_chain_flush(chain);
> > >>
> > >> -     /* Wait for RCU callbacks to release the reference count. */
> > >> +     INIT_WORK(&block->work, tcf_block_put_final);
> > >> +     /* Wait for RCU callbacks to release the reference count and make
> > >> +      * sure their works have been queued before this.
> > >> +      */
> > >>       rcu_barrier();
> > >> +     tcf_queue_work(&block->work);
> > >> +     rtnl_unlock();
> > >> +}
> > >
> > >
> > > On a loaded server, rcu_barrier() typically takes 4 ms.
> > >
> > > Way better than synchronize_rcu() (about 90 ms) but still an issue when
> > > holding RTNL.
> > >
> > > We have thousands of filters, and management daemon restarts and rebuild
> > > TC hierarchy from scratch.
> > >
> > > Simply getting rid of 1000 old filters might block RTNL for a while, or
> > > maybe I misunderstood your patches.
> > >
> > 
> > Paul pointed out the same.
> > 
> > As I replied, this rcu_barrier() is NOT added by this patchset, it is already
> > there in current master branch.
> 
> You added the rtnl_lock()  rtnl_unlock()...
> 
> I really do not care if hundreds of tasks (not owning rtnl) call
> rcu_barrier()...
> 
> Also we are still using a 4.3 based kernel, and no rcu_barrier() is used
> in filters dismantle ( unregister_tcf_proto_ops() is not used in our
> workloads )
> 
> Somehow something went very wrong in net/sched in recent kernels.

Would this be a good time for me to repeat my suggestion that timers
be used to aggregate the work done in the workqueue handlers, thus
decreasing the number of rcu_barrier() calls done under RTNL?

							Thanx, Paul

  reply	other threads:[~2017-10-27 11:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27  1:24 [Patch net 00/16] net_sched: fix races with RCU callbacks Cong Wang
2017-10-27  1:24 ` [Patch net 01/16] net_sched: introduce a workqueue for RCU callbacks of tc filter Cong Wang
2017-10-27  4:05   ` Eric Dumazet
2017-10-27  4:28     ` Cong Wang
2017-10-27  4:39       ` Eric Dumazet
2017-10-27 11:55         ` Paul E. McKenney [this message]
2017-10-27 15:43           ` Cong Wang
2017-10-27 15:37         ` Cong Wang
2017-10-27 15:52           ` Eric Dumazet
2017-10-27  1:24 ` [Patch net 02/16] net_sched: use tcf_queue_work() in basic filter Cong Wang
2017-10-27  1:24 ` [Patch net 03/16] net_sched: use tcf_queue_work() in bpf filter Cong Wang
2017-10-27  1:24 ` [Patch net 04/16] net_sched: use tcf_queue_work() in cgroup filter Cong Wang
2017-10-27  1:24 ` [Patch net 05/16] net_sched: use tcf_queue_work() in flow filter Cong Wang
2017-10-27  1:24 ` [Patch net 06/16] net_sched: use tcf_queue_work() in flower filter Cong Wang
2017-10-27  1:24 ` [Patch net 07/16] net_sched: use tcf_queue_work() in fw filter Cong Wang
2017-10-27  1:24 ` [Patch net 08/16] net_sched: use tcf_queue_work() in matchall filter Cong Wang
2017-10-27  1:24 ` [Patch net 09/16] net_sched: use tcf_queue_work() in u32 filter Cong Wang
2017-10-27  1:24 ` [Patch net 10/16] net_sched: use tcf_queue_work() in route filter Cong Wang
2017-10-27  1:24 ` [Patch net 11/16] net_sched: use tcf_queue_work() in rsvp filter Cong Wang
2017-10-27  1:24 ` [Patch net 12/16] net_sched: use tcf_queue_work() in tcindex filter Cong Wang
2017-10-27  1:24 ` [Patch net 13/16] net_sched: add rtnl assertion to tcf_exts_destroy() Cong Wang
2017-10-27  1:24 ` [Patch net 14/16] net_sched: fix call_rcu() race on act_sample module removal Cong Wang
2017-10-27  1:24 ` [Patch net 15/16] selftests: Introduce a new script to generate tc batch file Cong Wang
2017-10-27  1:24 ` [Patch net 16/16] selftests: Introduce a new test case to tc testsuite Cong Wang
2017-10-29 14:41 ` [Patch net 00/16] net_sched: fix races with RCU callbacks David Miller
2017-10-30 22:39 ` Lucas Bates
2017-10-30 23:12   ` Cong Wang
2017-10-31  1:46     ` Lucas Bates
     [not found]     ` <CAMDBHYJTMv4MDQENNKjOXaUBHyXicOnkM_j+i7__3d1CAgdVRg@mail.gmail.com>
2017-10-31  5:44       ` Cong Wang
2017-10-31 11:00         ` Jamal Hadi Salim
2017-10-31 18:55           ` Lucas Bates
2017-10-31 19:13             ` Lucas Bates
2017-10-31 22:09               ` Cong Wang
2017-10-31 23:02                 ` Cong Wang
2017-11-01 16:55                   ` Lucas Bates
2017-11-01 16:59                     ` Cong Wang

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=20171027115550.GG3659@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=chrism@mellanox.com \
    --cc=daniel@iogearbox.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=john.fastabend@gmail.com \
    --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 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).