Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752023AbdHaPzI (ORCPT ); Thu, 31 Aug 2017 11:55:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36316 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751848AbdHaPoN (ORCPT ); Thu, 31 Aug 2017 11:44:13 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "George G. Davis" , Marek Szyprowski , Michal Nazarewicz , Joonsoo Kim , "Aneesh Kumar K.V" , Laurent Pinchart , Andrew Morton , Linus Torvalds Subject: [PATCH 3.18 12/24] mm: cma: fix totalcma_pages to include DT defined CMA regions Date: Thu, 31 Aug 2017 17:43:48 +0200 Message-Id: <20170831154105.807230580@linuxfoundation.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170831154105.116844281@linuxfoundation.org> References: <20170831154105.116844281@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1533 Lines: 47 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: George G. Davis commit 94737a85f332aee75255960eaa16e89ddfa4c75a upstream. The totalcma_pages variable is not updated to account for CMA regions defined via device tree reserved-memory sub-nodes. Fix this omission by moving the calculation of totalcma_pages into cma_init_reserved_mem() instead of cma_declare_contiguous() such that it will include reserved memory used by all CMA regions. Signed-off-by: George G. Davis Cc: Marek Szyprowski Acked-by: Michal Nazarewicz Cc: Joonsoo Kim Cc: "Aneesh Kumar K.V" Cc: Laurent Pinchart Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/cma.c +++ b/mm/cma.c @@ -200,6 +200,7 @@ int __init cma_init_reserved_mem(phys_ad cma->order_per_bit = order_per_bit; *res_cma = cma; cma_area_count++; + totalcma_pages += (size / PAGE_SIZE); return 0; } @@ -338,7 +339,6 @@ int __init cma_declare_contiguous(phys_a if (ret) goto err; - totalcma_pages += (size / PAGE_SIZE); pr_info("Reserved %ld MiB at %pa\n", (unsigned long)size / SZ_1M, &base); return 0;