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=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 AB629C169C4 for ; Tue, 29 Jan 2019 11:48:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F42F20882 for ; Tue, 29 Jan 2019 11:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548762485; bh=1Px8vm9PFmdDJlaxFdtMvuS2S067/8gyPP7vjNXiMcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=l+xlHWRXIG5Up/3FmOZOSqfwUG6eHU6dMFSZpduDK4FQoM5M9a8i11b4l/+akcd/n ZOdwuIu3f9/jtFbKeIa9FPTURx05FIb1hi0P/txM9JbS+NAL+RqFTrBpa3zOAhhkQz S13R5Zs4r08K7Gw/yON3gVCWCQ3YZ/p4PGHqweGc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731274AbfA2LsD (ORCPT ); Tue, 29 Jan 2019 06:48:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:38792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731254AbfA2Lr6 (ORCPT ); Tue, 29 Jan 2019 06:47:58 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 6DB0020882; Tue, 29 Jan 2019 11:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548762477; bh=1Px8vm9PFmdDJlaxFdtMvuS2S067/8gyPP7vjNXiMcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=keM4/fxqBMDE4eLKXbeWiwgXqX3JNhl+wWoKWWWXHgDs73vGy5ygPVz+oZRqDWVO5 oEGKdR+whgEJ5ENa6XVOvcf9PJ8l9MyRTpaf0T11cS1M1C2l3X2JsGYrW7oXTEqjry 2bDA7ECSaNf+C5kv2jP/J3qRe5uyDAfjyLhJ0Thw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugeniy Paltsev , Vineet Gupta Subject: [PATCH 4.14 19/68] ARC: adjust memblock_reserve of kernel memory Date: Tue, 29 Jan 2019 12:35:41 +0100 Message-Id: <20190129113133.236299200@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129113131.751891514@linuxfoundation.org> References: <20190129113131.751891514@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eugeniy Paltsev commit a3010a0465383300f909f62b8a83f83ffa7b2517 upstream. In setup_arch_memory we reserve the memory area wherein the kernel is located. Current implementation may reserve more memory than it actually required in case of CONFIG_LINUX_LINK_BASE is not equal to CONFIG_LINUX_RAM_BASE. This happens because we calculate start of the reserved region relatively to the CONFIG_LINUX_RAM_BASE and end of the region relatively to the CONFIG_LINUX_RAM_BASE. For example in case of HSDK board we wasted 256MiB of physical memory: ------------------->8------------------------------ Memory: 770416K/1048576K available (5496K kernel code, 240K rwdata, 1064K rodata, 2200K init, 275K bss, 278160K reserved, 0K cma-reserved) ------------------->8------------------------------ Fix that. Fixes: 9ed68785f7f2b ("ARC: mm: Decouple RAM base address from kernel link addr") Cc: stable@vger.kernel.org #4.14+ Signed-off-by: Eugeniy Paltsev Signed-off-by: Vineet Gupta Signed-off-by: Greg Kroah-Hartman --- arch/arc/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c @@ -138,7 +138,8 @@ void __init setup_arch_memory(void) */ memblock_add_node(low_mem_start, low_mem_sz, 0); - memblock_reserve(low_mem_start, __pa(_end) - low_mem_start); + memblock_reserve(CONFIG_LINUX_LINK_BASE, + __pa(_end) - CONFIG_LINUX_LINK_BASE); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start)