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: 10656377 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 5DD221751 for ; Thu, 25 Oct 2018 18:34:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 538012C389 for ; Thu, 25 Oct 2018 18:34:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 476ED2C38F; Thu, 25 Oct 2018 18:34:57 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2076E2C389 for ; Thu, 25 Oct 2018 18:34:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 541096B02B3; Thu, 25 Oct 2018 14:34:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4F0FC6B02B4; Thu, 25 Oct 2018 14:34:52 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E3626B02B5; Thu, 25 Oct 2018 14:34:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id F3AF46B02B3 for ; Thu, 25 Oct 2018 14:34:51 -0400 (EDT) Received: by mail-pg1-f200.google.com with SMTP id v10-v6so6331637pgs.15 for ; Thu, 25 Oct 2018 11:34:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version; bh=yEHHbPmBeAlbrZgiaqyNW2coIWtjP3zSyTSwY0/5xIU=; b=F7fVz8gRvb7pk8zVzcu5vyYO1xu4KgUJeJrEqfqj9eVitya7AUVfsZ03a9NAz14mn/ agjmAfCQryrqi+2jhGKhGrZqzT1HyKWYwMkvs581Ds0PY85aMuicppq1MHoDBdh/Y8l2 7c1LQvz2f3cX3rrd+D6oJtSe5Msd4ta4D/xulCDNDzkYEnPDJYup1skpYkd0TRkBLzFI kCoB4+6AU9qdfy6CS2ETr7TUGijSHetaisIR8GZ9DtojlH+2Ezgppz481lghTgaQILjz BKgdRji5q4rN9Dob1R0ZtjlORnkzppHy1OXy/V0qygbfdslp/1RD0vXelLN7cGS+X0hl i77w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of miles.chen@mediatek.com designates 210.61.82.184 as permitted sender) smtp.mailfrom=miles.chen@mediatek.com X-Gm-Message-State: AGRZ1gLoKg6+SuP1Qu5FPqbElaFVIBWFxy4FORSiX+CYGEMTzSdWf/Fk b4go8SYSRT1rmnZnUr93OIYRej4IpucVof1o52/fn+uFjOvWc4P3nrtztC1CJV97PPKJWtrKzry Es6yl1uTWMs5PXHxFuyPJkpZ8ZMFHwrqX+tZkmEqhau3jPNTt+tErgGOosteZaB+xgw== X-Received: by 2002:a62:583:: with SMTP id 125-v6mr332248pff.186.1540492491670; Thu, 25 Oct 2018 11:34:51 -0700 (PDT) X-Google-Smtp-Source: AJdET5cN0+DC4PSB1TDU4E/giMKRdAWQOdTYVWq2xwR/qwFg/noUoq22o4Z1veuo7cFAE04/0/ow X-Received: by 2002:a62:583:: with SMTP id 125-v6mr332212pff.186.1540492490861; Thu, 25 Oct 2018 11:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540492490; cv=none; d=google.com; s=arc-20160816; b=R0G4gWUMzhrdYS/855Rpdw7t8RINgv5+QAT4AseHctGVj/eTLgv4EBiU3zUR1nr9y/ mN89epS+ONTul869/V6+RB4n/vNanR79tMyQfCOxvmHrvWnyU9HxvjchuDkNuoBL3F4e qS071GJkFI5GSNSkyD5ng3ASZ8NsUoEYKaEq2QC8x5Nt2VNJs5gGU2jqBuPfAulEmcjR upCtpnb5TztkkvIOm70LUOihVCdWfHZrKXDAI3ntMZ7/Qw9wQkrDJLA0BMvpK7HXeXdn fyrv19aLtxQXma41g3ZoEJeSUSAee5w5zTICHUvIc2GY5sc6GXcPz50VMlfgMl6f3E5z JDfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:subject:cc:to:from; bh=yEHHbPmBeAlbrZgiaqyNW2coIWtjP3zSyTSwY0/5xIU=; b=Mk90QwMBCCYovNxzhXHNHgsbFWHnSK2vOLhXV8haVueSXjaAepzhTRT75oBpL6LHmZ LdEtZDxow9ZeOB6wVwyx0MoCupai+M55NDzCoQnTV2q9V52vOO6NQPjWrEQHHg0tlo/P IDJ89mIyVZTMHASsYkBQKFXIFWPFA09Bif17T/6+kwXPhOYGNVhRGYA8XDfG9EUbmwsX MH229ytU2J5aGgo33dwVsfg05VxfkR/DhiVA5yE1qyTS/g2U3Zo8T/A0KNT+zcXk15oD kxLMaf4bs3CURn+TeDpLjXisXiaddMfww03qZRnYfKG4veBjmEFyyaRvdXXMQvIV8TlZ q1zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of miles.chen@mediatek.com designates 210.61.82.184 as permitted sender) smtp.mailfrom=miles.chen@mediatek.com Received: from mailgw02.mediatek.com ([210.61.82.184]) by mx.google.com with ESMTPS id w11-v6si9112637pgf.587.2018.10.25.11.34.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Oct 2018 11:34:50 -0700 (PDT) Received-SPF: pass (google.com: domain of miles.chen@mediatek.com designates 210.61.82.184 as permitted sender) client-ip=210.61.82.184; Authentication-Results: mx.google.com; spf=pass (google.com: domain of miles.chen@mediatek.com designates 210.61.82.184 as permitted sender) smtp.mailfrom=miles.chen@mediatek.com 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 X-TM-SNTS-SMTP: 4FF00C5B741866195DAC95A7E87BF5F54FBF0F6D2BFC73E0DFDB6A1AF23B828F2000:8 X-MTK: N X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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; }