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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 7AB23C432C3 for ; Tue, 3 Dec 2019 22:54:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4BBA9216C8 for ; Tue, 3 Dec 2019 22:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413665; bh=6N6utb28xFcbw1WnBmmazrCLf9h//ber+CLlhqfmkag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=n9mOJp1o6EJRyaCMTzeDEbESnvrkLqyvK+lu+ibEPKHLwWHYFHNlK24Q1IyT+tXBx vVr3rckg+rzSaFLhHZVYC8c8OOJWBX/fTZfc8WbT4MA/l2aNwa2LP4Z7Go+ej33LB8 rhSDDLPfAYo1smKuq5Z+LQQxXKGx3mStWxGgrAeo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727976AbfLCWyU (ORCPT ); Tue, 3 Dec 2019 17:54:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:48010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729996AbfLCWyP (ORCPT ); Tue, 3 Dec 2019 17:54:15 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8D1FD2053B; Tue, 3 Dec 2019 22:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413655; bh=6N6utb28xFcbw1WnBmmazrCLf9h//ber+CLlhqfmkag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i52HfPUQdzR/Vf6lndjcgQhmCNUhYejymT1K3XgnVwYs8xgrHirVdIJngmMxUHbnz y1whCsAYcyd0Wn5GH7cIQrGoH6/zq9dxNCTCtoZWvY0vnitt2oopWrXk9pMYQl9+LQ 7IkojV4TuXgjEpqLNXTY0+dIotO3eS2tkJMs+lso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huang Shijie , Andrew Morton , Alexey Skidanov , Linus Torvalds , Sasha Levin Subject: [PATCH 4.19 209/321] lib/genalloc.c: use vzalloc_node() to allocate the bitmap Date: Tue, 3 Dec 2019 23:34:35 +0100 Message-Id: <20191203223437.994770876@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203223427.103571230@linuxfoundation.org> References: <20191203223427.103571230@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 5deb25c40a5a1..f365d71cdc774 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