From patchwork Tue Apr 30 16:30:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 2505671 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id DF46A3FD85 for ; Tue, 30 Apr 2013 16:34:49 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXDUG-0007Gh-9v; Tue, 30 Apr 2013 16:33:05 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXDTh-0005xA-Kr; Tue, 30 Apr 2013 16:32:29 +0000 Received: from mail-wg0-x234.google.com ([2a00:1450:400c:c00::234]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXDSp-0005le-3m for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2013 16:31:37 +0000 Received: by mail-wg0-f52.google.com with SMTP id k13so640394wgh.31 for ; Tue, 30 Apr 2013 09:31:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=6t94NuqcRwHr9qB0j7FrrGIU4MUe5ASLpdGESzA6J6I=; b=Nr9lq9a/M7eASxYleQFtS/9lTbAqlFKck4mdYxZ0GZR9IYMszYg2cfghsEdcoCHt0l hihWp120vTWCCqwcDEpLS9bzrikHmICw4cL5S+wfJC2H1nIXyChWuzEx50C5MTKhXCzM xGJhtTM4wotn1O4YdkqEblsk7KjkTq5sD6rP0XdCG9FxkR2gPyggWec+eTisnl3SBp5K F/A7bLeAxUxmiYL0lxK+5DBl3SgfTGNlZ0u+hyWl6x6NZ01jl6VWw4ms+O0alIOx2afs 9wEDgUHXCR8KvRX9DnVr33QTqz5K7I1kVQhj4R7EsxmJazWGGhzWUFj7NK4XbzglASKC TzUQ== X-Received: by 10.180.182.110 with SMTP id ed14mr25723020wic.6.1367339473726; Tue, 30 Apr 2013 09:31:13 -0700 (PDT) Received: from localhost.localdomain (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id k5sm30044708wiy.5.2013.04.30.09.31.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 30 Apr 2013 09:31:13 -0700 (PDT) From: Steve Capper To: linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 6/9] ARM64: mm: Restore memblock limit when map_mem finished. Date: Tue, 30 Apr 2013 17:30:45 +0100 Message-Id: <1367339448-21727-7-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1367339448-21727-1-git-send-email-steve.capper@linaro.org> References: <1367339448-21727-1-git-send-email-steve.capper@linaro.org> X-Gm-Message-State: ALoCoQkOTlbyy1CJetzPnrYCRFwg8eXsCobkcbz5CEC51NTQ1HZH373x9onKqz3LufLsT+q9ERB+ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130430_123135_523843_73F68CA5 X-CRM114-Status: GOOD ( 12.79 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Steve Capper , Catalin Marinas , Will Deacon , Michal Hocko , Ken Chen , Mel Gorman X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 --- 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 70b8cd4..d23188c 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();