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 3E9F2C43603 for ; Wed, 4 Dec 2019 18:06:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0106D20675 for ; Wed, 4 Dec 2019 18:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482768; bh=6N6utb28xFcbw1WnBmmazrCLf9h//ber+CLlhqfmkag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2ivne3rc0IsLVuN43hlzDdGXodg4AedoRst5iTVKMdCtNY+5ldWSFYp7G8CK0SjWE WsU/pEmqNH/VpWkg2KiP8CvJuGJDL5K6r11M1vaIcg7P+t6s70hTSHVa11rTxvqm6S I5xkrzQUjEtJfu5gQZbQo/5ezt7vrS8N2WUdIrIE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730498AbfLDSGG (ORCPT ); Wed, 4 Dec 2019 13:06:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:53436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729860AbfLDSF7 (ORCPT ); Wed, 4 Dec 2019 13:05:59 -0500 Received: from localhost (unknown [217.68.49.72]) (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 10AF4214AF; Wed, 4 Dec 2019 18:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482758; bh=6N6utb28xFcbw1WnBmmazrCLf9h//ber+CLlhqfmkag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NxsY90JbwBYe3RhxwtiIzRlS8abwU66UlztifQlw7lN3QR5YHptSpggBwo/TdpRKR OfY5jWsF0hqQHzyHYI0TeDEfHPIXByF+7bZpTmAR87Bd8Et5F0UMd6Fk+5Nsy4Xcs6 f8CWl+PQ+YwXEb+yI8FTBRK8Hy1YMMnnZemHyLzU= 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.14 122/209] lib/genalloc.c: use vzalloc_node() to allocate the bitmap Date: Wed, 4 Dec 2019 18:55:34 +0100 Message-Id: <20191204175331.471748780@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@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