Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2232073ima; Thu, 25 Oct 2018 11:36:40 -0700 (PDT) X-Google-Smtp-Source: AJdET5edvlAqDi8mfmkz0CNY6qp+It8fc6UynsrHASPJGIZuo+QTSYlzpk8D2SeP7tmDMV0Tv65I X-Received: by 2002:a62:5441:: with SMTP id i62-v6mr317908pfb.155.1540492600208; Thu, 25 Oct 2018 11:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540492600; cv=none; d=google.com; s=arc-20160816; b=mwRIbYmXFWGK58Yq+kh4GfQ7tskbDrciSJoCOqHXcNr7JHmiqj3teRK3Jc5oWz43S0 k7jvNjAAQPqiD0YGeGHx7C4m0FsiA7U11LXc8gFp11hhl6T9zXFzygtYPzLyknQQtyag QWYFwSbYzzhOyhyKAb6Q/k8jVYLnGX5VViHJs7myd33zaUgSyfpynpVPZJQdFGiWtvuV 2bbfA1+oRIR51HHZZInXKbEA/BYPCwGqQm+dnCp+GeAnPfqvNWkiPi2Px90WpCBl8qIo nA47BQmCdsGXI+MScd4HTW3iCl/1yIEkYTI35xv30kFsVybUrQmAVvHZ7axN3xkOTkQG l0pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=yEHHbPmBeAlbrZgiaqyNW2coIWtjP3zSyTSwY0/5xIU=; b=iM2yf4BNYC2XaEdJbs+6x+gPSY1G7ATYdmcO++JstKm77w3bg1Pb4/4i9PRVKspWX+ auK9BcB55Gtx3HfAo2OpeQvfh3twDSPvcTthYE7tqa7I9q8k9/i4sUaE3TwZD/efObgg 1AJkRv/WRibbsIsJCUNPcER+q/fCv8GLXWL2JnaI8Qbke9PrqvCEchmo/NnaKV4h7ZGx qOKB8yU1OzruED/VR4YV0GoPM8uswC5fxA2n2ATBG1MdtM2CNhuAYXpkaBuMwhkf4Z7S 5J+5+lk2rnSYePcXYpuz7dCCOaj/JoKgurwc1OpdRVhWmXi/hdGqz6pY94jA/YshAwe+ Vn1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61-v6si8703540plr.72.2018.10.25.11.36.23; Thu, 25 Oct 2018 11:36:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727537AbeJZDIq (ORCPT + 99 others); Thu, 25 Oct 2018 23:08:46 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:21268 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727313AbeJZDIp (ORCPT ); Thu, 25 Oct 2018 23:08:45 -0400 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 CC: , , , , , Miles Chen 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 Content-Type: text/plain X-TM-SNTS-SMTP: 4FF00C5B741866195DAC95A7E87BF5F54FBF0F6D2BFC73E0DFDB6A1AF23B828F2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.18.0