• Francois Romieu's avatar
    atm: remove an unnecessary loop · c55fa3cc
    Francois Romieu authored
    Andrey reported this kernel warning:
    
    WARNING: CPU: 0 PID: 4114 at kernel/sched/core.c:7737 __might_sleep+0x149/0x1a0
    do not call blocking ops when !TASK_RUNNING; state=1 set at
    [<ffffffff813fcb22>] prepare_to_wait+0x182/0x530
    
    The deeply nested alloc_skb is a problem.
    
    Diagnosis: nesting is wrong. It makes zero sense. Fix it and the
    implicit task state change problem automagically goes away.
    
    alloc_skb() does not need to be in the "while" loop.
    
    alloc_skb() does not need to be in the {prepare_to_wait/add_wait_queue ...
    finish_wait/remove_wait_queue} block.
    
    I claim that:
    - alloc_tx() should only perform the "wait_for_decent_tx_drain" part
    - alloc_skb() ought to be done directly in vcc_sendmsg
    - alloc_skb() failure can be handled gracefully in vcc_sendmsg
    - alloc_skb() may use a (m->msg_flags & MSG_DONTWAIT) dependent
      GFP_{KERNEL / ATOMIC} flag
    Reported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
    Reviewed-and-Tested-by: default avatarChas Williams <3chas3@gmail.com>
    Signed-off-by: default avatarChas Williams <3chas3@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c55fa3cc
common.c 21.4 KB