Skip to content

Commit

Permalink
Merge branch 'pkt_sched_cond_resched'
Browse files Browse the repository at this point in the history
Eric Dumazet says:

====================
pkt_sched: allow scheduling points

We have seen delays of more than 50ms in class or qdisc dumps, in case
device is under high TX stress, even with the prior 4KB per skb limit.

With the new 16KB limit, this could translate to 200ms delays.

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

But before doing so, we need to remove the rcu locking from tc_dump_qdisc()
as David spotted.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Mar 12, 2014
2 parents a19a7ec + fba373d commit 62cf4be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/sched/sch_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1434,9 +1435,9 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
s_idx = cb->args[0];
s_q_idx = q_idx = cb->args[1];

rcu_read_lock();
idx = 0;
for_each_netdev_rcu(net, dev) {
ASSERT_RTNL();
for_each_netdev(net, dev) {
struct netdev_queue *dev_queue;

if (idx < s_idx)
Expand All @@ -1459,8 +1460,6 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
}

done:
rcu_read_unlock();

cb->args[0] = idx;
cb->args[1] = q_idx;

Expand Down Expand Up @@ -1617,6 +1616,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;
Expand Down

0 comments on commit 62cf4be

Please sign in to comment.