From patchwork Thu Oct 25 18:34:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miles Chen X-Patchwork-Id: 10656379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D7B113A4 for ; Thu, 25 Oct 2018 18:35:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3E812C389 for ; Thu, 25 Oct 2018 18:35:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E80D02C38F; Thu, 25 Oct 2018 18:35:13 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 7F49F2C389 for ; Thu, 25 Oct 2018 18:35:13 +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=LqcZS87SSjFg0Pv91ghfOvjGB1DSq0eTPkM+Lj4i9n8=; b=LVL40dw6rMm1cm AyQwnhisfnQiM1TSsCaUeSMBNDgEIpqoCnxMrcGxSJJUwLFWvQrs/HyWKOWnlMOMw35yC8yds0rq9 WphhgfzLNg07nivaxFZF01B3tIucxJHK1W+H13iUrpPRsCfteXx4TQHJS9X/WVKzqbTo5QVBYoCjk qx8xUDdoBVbqNAfWeH3eYUa/Qqo5B6YZh0hS4Q+VS5BSnQLADzcWwTWwB3g4CfTSbCM80v0kOUs4M STnYkBNl0XuKIYWXSefbA/+V2TyyLSxITDR2rgXPSTAdRcWeWa9kl3QjQgKDTJ2jIWhv0vxZUsh9D OEHHb0dE8sLQB1AmzN5A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFkTN-0004AC-M1; Thu, 25 Oct 2018 18:35:09 +0000 Received: from [210.61.82.184] (helo=mailgw02.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFkTJ-0003a8-Vs; Thu, 25 Oct 2018 18:35:07 +0000 X-UUID: 67fc4418746e4094b9b5ab5038d2827d-20181026 X-UUID: 67fc4418746e4094b9b5ab5038d2827d-20181026 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 96036498; Fri, 26 Oct 2018 02:34:44 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 26 Oct 2018 02:34:42 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 26 Oct 2018 02:34:42 +0800 From: To: Matthias Brugger Subject: [PATCH] mm/page_owner: use vmalloc instead of kmalloc Date: Fri, 26 Oct 2018 02:34:41 +0800 Message-ID: <1540492481-4144-1-git-send-email-miles.chen@mediatek.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-TM-SNTS-SMTP: 4FF00C5B741866195DAC95A7E87BF5F54FBF0F6D2BFC73E0DFDB6A1AF23B828F2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181025_113506_193933_DEAB312B X-CRM114-Status: GOOD ( 11.10 ) X-BeenThere: linux-arm-kernel@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-mm@kvack.org, Miles Chen , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Miles Chen The kbuf used by page owner is allocated by kmalloc(), which means it can use only normal memory and there might be a "out of memory" issue when we're out of normal memory. Use vmalloc() so we can also allocate kbuf from highmem on 32bit kernel. Signed-off-by: Miles Chen --- mm/page_owner.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_owner.c b/mm/page_owner.c index d80adfe702d3..7e6962adaa79 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include #include -#include #include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include #include "internal.h" @@ -351,7 +351,7 @@ print_page_owner(char __user *buf, size_t count, unsigned long pfn, .skip = 0 }; - kbuf = kmalloc(count, GFP_KERNEL); + kbuf = vmalloc(count); if (!kbuf) return -ENOMEM; @@ -397,11 +397,11 @@ print_page_owner(char __user *buf, size_t count, unsigned long pfn, if (copy_to_user(buf, kbuf, ret)) ret = -EFAULT; - kfree(kbuf); + vfree(kbuf); return ret; err: - kfree(kbuf); + vfree(kbuf); return -ENOMEM; }