From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932395AbdAJWsC (ORCPT ); Tue, 10 Jan 2017 17:48:02 -0500 Received: from violet.fr.zoreil.com ([92.243.8.30]:57880 "EHLO violet.fr.zoreil.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932328AbdAJWsA (ORCPT ); Tue, 10 Jan 2017 17:48:00 -0500 Date: Tue, 10 Jan 2017 23:47:23 +0100 From: Francois Romieu To: Eric Dumazet Cc: Cong Wang , Andrey Konovalov , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev , LKML , Al Viro , Dmitry Vyukov , Kostya Serebryany , syzkaller Subject: Re: net/atm: warning in alloc_tx/__might_sleep Message-ID: <20170110224722.GA21775@electric-eye.fr.zoreil.com> Mail-Followup-To: Francois Romieu , Eric Dumazet , Cong Wang , Andrey Konovalov , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev , LKML , Al Viro , Dmitry Vyukov , Kostya Serebryany , syzkaller References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Organisation: Land of Sunshine Inc. User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric Dumazet : > On Tue, Jan 10, 2017 at 9:35 AM, Cong Wang wrote: > > On Mon, Jan 9, 2017 at 9:20 AM, Andrey Konovalov 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