From patchwork Wed Apr 26 03:08:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunhui Li X-Patchwork-Id: 9700195 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C4126603F7 for ; Wed, 26 Apr 2017 03:09:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7F7528464 for ; Wed, 26 Apr 2017 03:09:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B08A2847F; Wed, 26 Apr 2017 03:09:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4307328464 for ; Wed, 26 Apr 2017 03:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0RKz6AWqUA7ycuXtO4C3Z2SQIK89iWb/nAzF5GZ8Im0=; b=SLw61ocwurKgCy Ro+Hxl5EUw2W77lFux9o4KL2yCXHRe4u1naHTnEWJNiEOI2eca7dbtBvSfy+kCvYTD3hgi945tY5s fGl4Hm2mk8DCin4tpFglTvm2TdmqhqCsIhRzNqFC+curbgSjP43icK55wdlYRtKJMepZEhFRnyI7v X8TBvNzf+vEWZ8Av9+HWAk6rEOF5PFKEF2lx3iVQkhKRKbALNA7o3S5FSAgbh/jgoP9YPLZA1gJRO Vqqhw7dc3GAKJkYLRVZui+w/hJctOQjTtCdTM9GowlDyiBNnBLZ2AUmxM1GnzeN1vIj8AUt8vvl+p ld9QE7mGXC0TRDUnoM8A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d3DKr-0003wx-9F; Wed, 26 Apr 2017 03:09:45 +0000 Received: from [210.61.82.184] (helo=mailgw02.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d3DKm-0003gc-Q0; Wed, 26 Apr 2017 03:09:43 +0000 Received: from mtkhts07.mediatek.inc [(172.21.101.69)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 563965360; Wed, 26 Apr 2017 11:09:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkhts07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Wed, 26 Apr 2017 11:09:00 +0800 From: Chunhui Li To: Alexander Viro , Matthias Brugger Subject: [PATCH] fs: seq_buf_alloc use vmalloc for high order allocations Date: Wed, 26 Apr 2017 11:08:59 +0800 Message-ID: <20170426030859.15420-1-chunhui.li@mediatek.com> X-Mailer: git-send-email 2.9.2 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170425_200940_993736_09763C55 X-CRM114-Status: GOOD ( 14.40 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wsd_upstream@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, "chunhui.li" , linux-fsdevel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: "chunhui.li" Hi Sirs, I sent this patch on 2017.4.5 but got no response, could you please check it? Maybe you have concern about the patch, your comments and suggestions are welcome! Best Regards For high order allocations, use vmalloc() to reduce physically contiguous memory consumption and avoid memory fragmentation issues Signed-off-by: chunhui.li --- fs/seq_file.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/fs/seq_file.c b/fs/seq_file.c index ca69fb9..4527e79 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -26,19 +26,17 @@ static void seq_set_overflow(struct seq_file *m) static void *seq_buf_alloc(unsigned long size) { void *buf; - gfp_t gfp = GFP_KERNEL; /* - * For high order allocations, use __GFP_NORETRY to avoid oom-killing - - * it's better to fall back to vmalloc() than to kill things. For small - * allocations, just use GFP_KERNEL which will oom kill, thus no need - * for vmalloc fallback. - */ + * For high order allocations, use vmalloc() to reduce physically + * contiguous memory usage and avoid memory fragmentation issue. + * For small allocations, just use GFP_KERNEL + * which will oom kill, thus no need for vmalloc fallback. + */ if (size > PAGE_SIZE) - gfp |= __GFP_NORETRY | __GFP_NOWARN; - buf = kmalloc(size, gfp); - if (!buf && size > PAGE_SIZE) buf = vmalloc(size); + else + buf = kmalloc(size, GFP_KERNEL); return buf; }