diff mbox

[net-next] pkt_sched: add cond_resched() to class and qdisc dump

Message ID 1394244064.20149.51.camel@edumazet-glaptop2.roam.corp.google.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet March 8, 2014, 2:01 a.m. UTC
From: Eric Dumazet <edumazet@google.com>

We have seen delays of more than 50ms in class or qdisc dumps, in case
device is under high TX stress.

Add cond_resched() to give a chance to higher prio tasks to get cpu.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
Google-Bug-Id: 13317737

 net/sched/sch_api.c |    2 ++
 1 file changed, 2 insertions(+)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller March 10, 2014, 7:32 p.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 07 Mar 2014 18:01:04 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> We have seen delays of more than 50ms in class or qdisc dumps, in case
> device is under high TX stress.
> 
> Add cond_resched() to give a chance to higher prio tasks to get cpu.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Is it OK to sleep (or rather: cond_resched()) in an RCU region?
That's what will potentially happen via tc_dump_qdisc() it seems.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet March 10, 2014, 8:12 p.m. UTC | #2
On Mon, 2014-03-10 at 15:32 -0400, David Miller wrote:

> Is it OK to sleep (or rather: cond_resched()) in an RCU region?
> That's what will potentially happen via tc_dump_qdisc() it seems.

Hmpf, you are right I forgot this.

RTNL protects us in tc_dump_qdisc().

I need to remove this useless rcu protection.

Thanks


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 1313145e3b86..15974e38cada 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1303,6 +1303,7 @@  static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
 	struct gnet_dump d;
 	struct qdisc_size_table *stab;
 
+	cond_resched();
 	nlh = nlmsg_put(skb, portid, seq, event, sizeof(*tcm), flags);
 	if (!nlh)
 		goto out_nlmsg_trim;
@@ -1617,6 +1618,7 @@  static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
 	struct gnet_dump d;
 	const struct Qdisc_class_ops *cl_ops = q->ops->cl_ops;
 
+	cond_resched();
 	nlh = nlmsg_put(skb, portid, seq, event, sizeof(*tcm), flags);
 	if (!nlh)
 		goto out_nlmsg_trim;