From patchwork Tue Mar 29 12:58:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 8686631 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DE6839F44D for ; Tue, 29 Mar 2016 12:59:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 16BDE202F8 for ; Tue, 29 Mar 2016 12:59:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2FB9C202F2 for ; Tue, 29 Mar 2016 12:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756036AbcC2M6o (ORCPT ); Tue, 29 Mar 2016 08:58:44 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:34956 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753064AbcC2M6m (ORCPT ); Tue, 29 Mar 2016 08:58:42 -0400 Received: by mail-pa0-f53.google.com with SMTP id td3so13127120pab.2; Tue, 29 Mar 2016 05:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=o8nBk6Ae133nVXwzL7PtRgNGIFvazUHMINghtHFjzbg=; b=zvlY+5d2bNNWlyVZcBCLtfP5lOyaMpuaJYfB79mK85v5liwDK9egtCnO4bQuqtaUqb Oz99PO75FtZWnFBozgotJ4KPA1eC1ezoH12LehAOWixLTn1tCucHVYPDpj0xN2O36ja1 Vq0C18TUbzPBa3ZY4ZEvgBfG1Bxe3HpEXmI6XCOTt/wHWNpYLTSm3CNd1WRZMtMeWplM 7r89JPyjMeAKAL4dbW24RuIIkVN6R2RIfrhR+VWjDBklSQbtTOSSwQ3rKX5b/R5XCD2Q 35CyRHRdV4yHg1cjGYMzBWkl89xc6ZNL5G3uACCvgfgO6R4Ajkg00JMYRCPEqrLG9XKL bhFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=o8nBk6Ae133nVXwzL7PtRgNGIFvazUHMINghtHFjzbg=; b=mLNUWhgogEMIUtct8jMsdFF1GnRYFoEF5t2M/sAgyMpb+yNtAi1tMduh/2krXwPWHa hC1q1tS1hbNGmroe2q2z9r8twEnA+y4KFqsc01629I1OA/oKI0syJS7/MLpPiZIQTrAS S/kE1JppwxIxJ7wwBqcknFkPlCX8AWDVKkOtdYieeK9O0m5CD8y1bFhjFAudHOZrlipU ievoZEV6oAEdRI14OyfbwH/rbEDtqv4jMdrjpWvmp3E5W5eKw4LWL0XaXOmXaYXGe5IA bzgk2+lSgmXFljJ6UyGdl8N+f/zkaZEPZg5jgh0ayV0WbpkepI4I5U+EIRj2/5P1aStG rMAQ== X-Gm-Message-State: AD7BkJLB3X+s1rlzluIVvKvxgj7BEHVJrIJ9J1LI7cniciXpQSDEf8jey0RgKuYPD4mMeA== X-Received: by 10.66.193.226 with SMTP id hr2mr3271951pac.20.1459256322059; Tue, 29 Mar 2016 05:58:42 -0700 (PDT) Received: from [172.29.161.161] ([172.29.161.161]) by smtp.googlemail.com with ESMTPSA id b74sm43168472pfd.24.2016.03.29.05.58.40 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 29 Mar 2016 05:58:41 -0700 (PDT) Message-ID: <1459256320.6473.160.camel@edumazet-glaptop3.roam.corp.google.com> Subject: Re: [PATCH] mwifiex: add __GFP_REPEAT to skb allocation call From: Eric Dumazet To: Wei-Ning Huang Cc: Kalle Valo , Linux Wireless , LKML , Amitkumar Karwar , Nishant Sarmukadam , Sameer Nanda , netdev@vger.kernel.org, Sonny Rao , Douglas Anderson Date: Tue, 29 Mar 2016 05:58:40 -0700 In-Reply-To: References: <1459226840-36287-1-git-send-email-wnhuang@chromium.org> <87vb45brxc.fsf@kamboji.qca.qualcomm.com> X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, 2016-03-29 at 17:27 +0800, Wei-Ning Huang wrote: > Adding some chromium devs to the thread. > > In, http://lxr.free-electrons.com/source/mm/page_alloc.c#L3152 > > The default mm retry allocation when 'order <= > PAGE_ALLOC_COSTLY_ORDER' of gfp_mask contains __GFP_REPEAT. > PAGE_ALLOC_COSTLY_ORDER is defined to be 3. On systems with page size > = 4K, this means memory compaction and retry is only done when the > size of allocation is <= 32K > In mwifiex, the allocation size is 64K. > When we have system with > memory fragmentation and allocation failed, there will be no retry. > This is why we need to add __GFP_REPEAT here to allow the system to > perform memory compaction and retry allocation. > > Maybe Amit@marvell can comment on if this is a good fix on this issue. > I'm also aware that marvell is the progress of implementing > scatter/gatter for mwifiex, which can also fix the issue. Before SG is implemented, you really need to copy incoming frames into smallest chunks (to get lowest skb->truesize) and leave the 64KB allocated stuff forever in the driver. __GFP_REPEAT wont really solve the issue. It seems the problem comes from the fact that the drivers calls dev_kfree_skb_any() after calling mwifiex_deaggr_sdio_pkt(), instead of recycling this very precious 64KB skb once memory gets fragmented. Another problem is that mwifiex_deaggr_sdio_pkt() uses mwifiex_alloc_dma_align_buf() with GFP_KERNEL | GFP_DMA Really GFP_DMA makes no sense here, since the skb is going to be processed by the stack, which has no such requirement. Please use normal skb allocations there. --- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index b2c839a..8404db5 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -1123,8 +1123,8 @@ static void mwifiex_deaggr_sdio_pkt(struct mwifiex_adapter *adapter, __func__, pkt_len, blk_size); break; } - skb_deaggr = mwifiex_alloc_dma_align_buf(pkt_len, - GFP_KERNEL | GFP_DMA); + skb_deaggr = __netdev_alloc_skb_ip_align(NULL, pkt_len, + GFP_KERNEL); if (!skb_deaggr) break; skb_put(skb_deaggr, pkt_len);