Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1555982

Re: net/atm: warning in alloc_tx/__might_sleep

From Francois Romieu <romieu@fr.zoreil.com>
Newsgroups linux.kernel
Subject Re: net/atm: warning in alloc_tx/__might_sleep
Date 2017-01-10 23:50 +0100
Message-ID <sYdoR-7d0-7@gated-at.bofh.it> (permalink)
References <sXLVD-74k-9@gated-at.bofh.it> <sY8yR-4e0-35@gated-at.bofh.it> <sY8Ix-4hr-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Eric Dumazet <edumazet@google.com> :
> On Tue, Jan 10, 2017 at 9:35 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> > On Mon, Jan 9, 2017 at 9:20 AM, Andrey Konovalov <andreyknvl@google.com> wrote:
> >
> > The fix should be straight-forward. Mind to try the attached patch?
> 
> 
> You forgot to remove schedule() ?

It may be clearer to split alloc_tx in two parts: only the unsleepable
"if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) {" part of it
contributes to the inner "while (!(skb = alloc_tx(vcc, eff))) {" block.

See net/atm/common.c
[...]
static struct sk_buff *alloc_tx(struct atm_vcc *vcc, unsigned int size)
{
        struct sk_buff *skb;
        struct sock *sk = sk_atm(vcc);

        if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) {
                pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",
                         sk_wmem_alloc_get(sk), size, sk->sk_sndbuf);
                return NULL;
        }
        while (!(skb = alloc_skb(size, GFP_KERNEL)))
                schedule();
        pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize);
        atomic_add(skb->truesize, &sk->sk_wmem_alloc);
        return skb;
}

The waiting stuff is related to vcc drain but the code makes it look as
if it were also related to skb alloc (it isn't).

It may be obvious for you but it took me a while to figure what the
code is supposed to achieve.

-- 
Ueimor

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

net/atm: warning in alloc_tx/__might_sleep Andrey Konovalov <andreyknvl@google.com> - 2017-01-09 18:30 +0100
  Re: net/atm: warning in alloc_tx/__might_sleep Cong Wang <xiyou.wangcong@gmail.com> - 2017-01-10 18:40 +0100
    Re: net/atm: warning in alloc_tx/__might_sleep Eric Dumazet <edumazet@google.com> - 2017-01-10 18:50 +0100
      Re: net/atm: warning in alloc_tx/__might_sleep Cong Wang <xiyou.wangcong@gmail.com> - 2017-01-10 19:00 +0100
      Re: net/atm: warning in alloc_tx/__might_sleep Francois Romieu <romieu@fr.zoreil.com> - 2017-01-10 23:50 +0100
        Re: net/atm: warning in alloc_tx/__might_sleep Eric Dumazet <eric.dumazet@gmail.com> - 2017-01-11 20:20 +0100
      Re: net/atm: warning in alloc_tx/__might_sleep Andrey Konovalov <andreyknvl@google.com> - 2017-01-11 11:20 +0100
  Re: net/atm: warning in alloc_tx/__might_sleep Chas Williams <3chas3@gmail.com> - 2017-01-11 15:40 +0100
    Re: net/atm: warning in alloc_tx/__might_sleep Michal Hocko <mhocko@kernel.org> - 2017-01-11 20:50 +0100
      Re: net/atm: warning in alloc_tx/__might_sleep Cong Wang <xiyou.wangcong@gmail.com> - 2017-01-12 05:40 +0100
        Re: net/atm: warning in alloc_tx/__might_sleep Chas Williams <3chas3@gmail.com> - 2017-01-12 11:50 +0100
    Re: net/atm: warning in alloc_tx/__might_sleep Michal Hocko <mhocko@kernel.org> - 2017-01-11 20:50 +0100

csiph-web