From patchwork Thu May 23 17:07:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 17160 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AD8962395B for ; Thu, 23 May 2013 17:09:40 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id bs12sf4253028qab.3 for ; Thu, 23 May 2013 10:08:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=QB/4MINkD5PY2tyBt1e0CnKHRJd0EtnkfQvwiHrG8Ro=; b=iBiMR4708x8QcB6tg3xzW8FpBDS5TzXW53SoE0PlQ+b4niYJ6K8l4DuZdvWimyZb/Y AjpmQpgGZjRXL/9ScW3WVxx2CyQWzUjudUIUqwq2UT33lRS8+2OIwJdYiWBI/o0NU9gc h2lIHSZ2On9UMWBPHd3hGjPX0gXTu1SnoY7ieFUmO44N0JE52oW6Dhwc6qWSgz2/YBZj oKmWnnymUSdXU1hNAM/C1bEWpcgWPi1G6ruWclGERc/Fpq+rZnm3SKA0Q3ReEd7AXtB/ wrOdLTJyWtd/OtIiB7PF5CLikLGeh/T5VAeNONA5eDBEe686D9rP72DMabPdiWWyM/xS N8DA== X-Received: by 10.236.128.207 with SMTP id f55mr6840451yhi.28.1369328925056; Thu, 23 May 2013 10:08:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.15.66 with SMTP id v2ls1596063qec.98.gmail; Thu, 23 May 2013 10:08:44 -0700 (PDT) X-Received: by 10.58.45.71 with SMTP id k7mr6014281vem.0.1369328924823; Thu, 23 May 2013 10:08:44 -0700 (PDT) Received: from mail-vb0-x229.google.com (mail-vb0-x229.google.com [2607:f8b0:400c:c02::229]) by mx.google.com with ESMTPS id un20si6866377veb.29.2013.05.23.10.08.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 10:08:44 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::229; Received: by mail-vb0-f41.google.com with SMTP id p14so2397785vbm.28 for ; Thu, 23 May 2013 10:08:44 -0700 (PDT) X-Received: by 10.220.238.4 with SMTP id kq4mr5985511vcb.73.1369328924635; Thu, 23 May 2013 10:08:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp61548vcs; Thu, 23 May 2013 10:08:44 -0700 (PDT) X-Received: by 10.181.13.169 with SMTP id ez9mr26340764wid.8.1369328899545; Thu, 23 May 2013 10:08:19 -0700 (PDT) Received: from mail-wi0-x231.google.com (mail-wi0-x231.google.com [2a00:1450:400c:c05::231]) by mx.google.com with ESMTPS id ub19si9579618wib.60.2013.05.23.10.08.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 10:08:19 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::231 is neither permitted nor denied by best guess record for domain of steve.capper@linaro.org) client-ip=2a00:1450:400c:c05::231; Received: by mail-wi0-f177.google.com with SMTP id hr14so2221196wib.10 for ; Thu, 23 May 2013 10:08:18 -0700 (PDT) X-Received: by 10.181.13.112 with SMTP id ex16mr45709947wid.28.1369328898725; Thu, 23 May 2013 10:08:18 -0700 (PDT) Received: from localhost.localdomain (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id ca19sm36989435wib.3.2013.05.23.10.08.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 May 2013 10:08:18 -0700 (PDT) From: Steve Capper To: linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Michal Hocko , Ken Chen , Mel Gorman , Catalin Marinas , Will Deacon , patches@linaro.org, Steve Capper Subject: [PATCH 06/11] ARM64: mm: Restore memblock limit when map_mem finished. Date: Thu, 23 May 2013 18:07:53 +0100 Message-Id: <1369328878-11706-7-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1369328878-11706-1-git-send-email-steve.capper@linaro.org> References: <1369328878-11706-1-git-send-email-steve.capper@linaro.org> X-Gm-Message-State: ALoCoQn2Vby+BIA9DECuu5gDx745WulBwfODdGQfwzaabJNS7e4AvFF+s09xs6A3aN7Q1otRXJfu X-Original-Sender: steve.capper@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In paging_init the memblock limit is set to restrict any addresses returned by early_alloc to fit within the initial direct kernel mapping in swapper_pg_dir. This allows map_mem to allocate puds, pmds and ptes from the initial direct kernel mapping. The limit stays low after paging_init() though, meaning any bootmem allocations will be from a restricted subset of memory. Gigabyte huge pages, for instance, are normally allocated from bootmem as their order (18) is too large for the default buddy allocator (MAX_ORDER = 11). This patch restores the memblock limit when map_mem has finished, allowing gigabyte huge pages (and other objects) to be allocated from all of bootmem. Signed-off-by: Steve Capper Acked-by: Catalin Marinas --- arch/arm64/mm/mmu.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index eeecc9c..9fa027b 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -297,6 +297,16 @@ static void __init map_mem(void) { struct memblock_region *reg; + /* + * Temporarily limit the memblock range. We need to do this as + * create_mapping requires puds, pmds and ptes to be allocated from + * memory addressable from the initial direct kernel mapping. + * + * The initial direct kernel mapping, located at swapper_pg_dir, + * gives us PGDIR_SIZE memory starting from PHYS_OFFSET (aligned). + */ + memblock_set_current_limit((PHYS_OFFSET & PGDIR_MASK) + PGDIR_SIZE); + /* map all the memory banks */ for_each_memblock(memory, reg) { phys_addr_t start = reg->base; @@ -307,6 +317,9 @@ static void __init map_mem(void) create_mapping(start, __phys_to_virt(start), end - start); } + + /* Limit no longer required. */ + memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE); } /* @@ -317,12 +330,6 @@ void __init paging_init(void) { void *zero_page; - /* - * Maximum PGDIR_SIZE addressable via the initial direct kernel - * mapping in swapper_pg_dir. - */ - memblock_set_current_limit((PHYS_OFFSET & PGDIR_MASK) + PGDIR_SIZE); - init_mem_pgprot(); map_mem();