Message ID | 1460399171.6473.562.camel@edumazet-glaptop3.roam.corp.google.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, 2016-04-11 at 11:26 -0700, Eric Dumazet wrote: > On Mon, 2016-04-11 at 11:02 -0700, Cong Wang wrote: > > > I am fine with either way as long as the loop stops on failure. Note that skb that could not be validated is already freed. So I do not see any value from stopping the loop, since we need to schedule the queue to avoid tx hang. Just process following skb if there is one, fact that skb is sent or dropped does not matter.
On Mon, Apr 11, 2016 at 11:30 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote: > On Mon, 2016-04-11 at 11:26 -0700, Eric Dumazet wrote: >> On Mon, 2016-04-11 at 11:02 -0700, Cong Wang wrote: >> >> > I am fine with either way as long as the loop stops on failure. > > > Note that skb that could not be validated is already freed. > > So I do not see any value from stopping the loop, since > we need to schedule the queue to avoid tx hang. > > Just process following skb if there is one, fact that skb is sent or > dropped does not matter. My point is, for example, in OOM case, we don't know processing more SKB would make it better or worse. Maybe we really need to check the error code to decide to continue to exit?
On Mon, 2016-04-11 at 16:19 -0700, Cong Wang wrote: > My point is, for example, in OOM case, we don't know processin > more SKB would make it better or worse. Maybe we really need to > check the error code to decide to continue to exit? Really, given this bug has been there for a long time (v3.18 ???), I doubt it matters. Nothing can tell that following packets in the qdisc need any transformation, and memory allocations. So I would just fix the bug in the simplest way. __qdisc_run() has all the checks needed to yield when needed (if (quota <= 0 || need_resched())) , no need to add more complexity there.
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index f18c35024207..07202d9ac4f6 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -159,12 +159,14 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, if (validate) skb = validate_xmit_skb_list(skb, dev); - if (skb) { + if (likely(skb)) { HARD_TX_LOCK(dev, txq, smp_processor_id()); if (!netif_xmit_frozen_or_stopped(txq)) skb = dev_hard_start_xmit(skb, dev, txq, &ret); HARD_TX_UNLOCK(dev, txq); + } else { + ... does all and return... } spin_lock(root_lock);