From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80029C432C0 for ; Fri, 22 Nov 2019 06:14:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43B7F2068E for ; Fri, 22 Nov 2019 06:14:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574403264; bh=sadsCLSkfQewsBhR0p+TkkxkWdvvoH2esadazE9u5Gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ncZZGgoOIYz8P0tuy3x1f5TMah7u2aEv8NOGupQmI+WYBihva6BU+GrSUb9YtrtsL dkY7J1PsgpJrYwhxqTeTWj025oCg7P7Gm4FhUi41p23gXc2PdVOFSLoeudt457Yw4k Y1umW353UF15VhHZAOfyqWrOoaqGdAH4ogBYFaQU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729725AbfKVGOX (ORCPT ); Fri, 22 Nov 2019 01:14:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:51566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728346AbfKVGOB (ORCPT ); Fri, 22 Nov 2019 01:14:01 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4849B2070E; Fri, 22 Nov 2019 06:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574403241; bh=sadsCLSkfQewsBhR0p+TkkxkWdvvoH2esadazE9u5Gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hwzkp5rroEiQcps1318ccx6wBjqtXiNtyn+7J2Ud/4aBvr9EFzt2mP1Kc/JUQFZOA 7oCkQ2k4Y/l1Q8Vrv7qSWBWv/x+E6WZGccoqc886vaJHJotAVDs+Vwx95vTzhdrgiZ j2CDIam7DYfBg5yq/dcnSGBw8Arl4BMfcw0IhSlE= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Huang Shijie , Andrew Morton , Alexey Skidanov , Linus Torvalds , Sasha Levin Subject: [PATCH AUTOSEL 4.4 52/68] lib/genalloc.c: use vzalloc_node() to allocate the bitmap Date: Fri, 22 Nov 2019 01:12:45 -0500 Message-Id: <20191122061301.4947-51-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122061301.4947-1-sashal@kernel.org> References: <20191122061301.4947-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huang Shijie [ Upstream commit 6862d2fc81859f88c1f3f660886427893f2b4f3f ] Some devices may have big memory on chip, such as over 1G. In some cases, the nbytes maybe bigger then 4M which is the bounday of the memory buddy system (4K default). So use vzalloc_node() to allocate the bitmap. Also use vfree to free it. Link: http://lkml.kernel.org/r/20181225015701.6289-1-sjhuang@iluvatar.ai Signed-off-by: Huang Shijie Reviewed-by: Andrew Morton Cc: Alexey Skidanov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- lib/genalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/genalloc.c b/lib/genalloc.c index e4303fb2a7b28..38764572ddde8 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c @@ -187,7 +187,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy int nbytes = sizeof(struct gen_pool_chunk) + BITS_TO_LONGS(nbits) * sizeof(long); - chunk = kzalloc_node(nbytes, GFP_KERNEL, nid); + chunk = vzalloc_node(nbytes, nid); if (unlikely(chunk == NULL)) return -ENOMEM; @@ -251,7 +251,7 @@ void gen_pool_destroy(struct gen_pool *pool) bit = find_next_bit(chunk->bits, end_bit, 0); BUG_ON(bit < end_bit); - kfree(chunk); + vfree(chunk); } kfree_const(pool->name); kfree(pool); -- 2.20.1