netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: edumazet@google.com
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com,
	john.fastabend@gmail.com, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us
Subject: Re: [PATCH net] net: sched: put back q.qlen into a single location
Date: Sat, 02 Mar 2019 14:11:43 -0800 (PST)	[thread overview]
Message-ID: <20190302.141143.2055373994720957055.davem@davemloft.net> (raw)
In-Reply-To: <20190228205543.172713-1-edumazet@google.com>

From: Eric Dumazet <edumazet@google.com>
Date: Thu, 28 Feb 2019 12:55:43 -0800

> In the series fc8b81a5981f ("Merge branch 'lockless-qdisc-series'")
> John made the assumption that the data path had no need to read
> the qdisc qlen (number of packets in the qdisc).
> 
> It is true when pfifo_fast is used as the root qdisc, or as direct MQ/MQPRIO
> children.
> 
> But pfifo_fast can be used as leaf in class full qdiscs, and existing
> logic needs to access the child qlen in an efficient way.
> 
> HTB breaks badly, since it uses cl->leaf.q->q.qlen in :
>   htb_activate() -> WARN_ON()
>   htb_dequeue_tree() to decide if a class can be htb_deactivated
>   when it has no more packets.
> 
> HFSC, DRR, CBQ, QFQ have similar issues, and some calls to
> qdisc_tree_reduce_backlog() also read q.qlen directly.
 ...
> This patch adds atomic_qlen (in the same location than qlen)
> and renames the following helpers, since we want to express
> they can be used without qdisc lock, and that qlen is no longer percpu.
> 
> - qdisc_qstats_cpu_qlen_dec -> qdisc_qstats_atomic_qlen_dec()
> - qdisc_qstats_cpu_qlen_inc -> qdisc_qstats_atomic_qlen_inc()
> 
> Later (net-next) we might revert this patch by tracking all these
> qlen uses and replace them by a more efficient method (not having
> to access a precise qlen, but an empty/non_empty status that might
> be less expensive to maintain/track).
> 
> Another possibility is to have a legacy pfifo_fast version that would
> be used when used a a child qdisc, since the parent qdisc needs
> a spinlock anyway. But then, future lockless qdiscs would also
> have the same problem.
> 
> Fixes: 7e66016f2c65 ("net: sched: helpers to sum qlen and qlen for per cpu logic")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable, thanks Eric.

  parent reply	other threads:[~2019-03-02 22:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 20:55 [PATCH net] net: sched: put back q.qlen into a single location Eric Dumazet
2019-03-02  7:07 ` David Miller
2019-03-02 22:11 ` David Miller [this message]
2019-03-03 21:32 ` John Fastabend
2019-03-08 11:01 ` 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=20190302.141143.2055373994720957055.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=edumazet@google.com \
    --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).