From patchwork Wed May 8 09:52:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 16786 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-bk0-f72.google.com (mail-bk0-f72.google.com [209.85.214.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB2A125B4A for ; Wed, 8 May 2013 09:53:40 +0000 (UTC) Received: by mail-bk0-f72.google.com with SMTP id jc3sf1461786bkc.7 for ; Wed, 08 May 2013 02:53:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received: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=6t94NuqcRwHr9qB0j7FrrGIU4MUe5ASLpdGESzA6J6I=; b=hZ066I1TtSfoh/78NZZVlT8PYhI0EdaoSJIoN9P8PHed9InAU/AuaoTGJHRos+B1qf oLDF0Lloj5NPZ0vOx/WiIt0l5RoZxgbV58lo7brzpBC9BTPBFL7eygK8KzKmN1C8oP62 i190AFHAO7/wTjzuWPHX1opPxJuhhMVdHMR5tGge+0S9jHM/tR8Lusi7WHusEng/n285 2ImKNUn/feXeO4+9Dd66gIvSMFR0IU7DdAZsYAIDck1146son8TtTmnc91f8hmupW/e+ 6TSTo9nHUKv/t4darOH9u4elEF0DTzA1JdyDORp/ciMY+pSti2FGwp4abLQXlzPTDQL8 I4AQ== X-Received: by 10.180.76.76 with SMTP id i12mr3988158wiw.6.1368006799438; Wed, 08 May 2013 02:53:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.181.12.17 with SMTP id em17ls1458243wid.18.canary; Wed, 08 May 2013 02:53:19 -0700 (PDT) X-Received: by 10.194.109.103 with SMTP id hr7mr4048864wjb.0.1368006799371; Wed, 08 May 2013 02:53:19 -0700 (PDT) Received: from mail-ve0-x22c.google.com (mail-ve0-x22c.google.com [2607:f8b0:400c:c01::22c]) by mx.google.com with ESMTPS id j3si9200453wje.58.2013.05.08.02.53.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 02:53:19 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22c 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:c01::22c; Received: by mail-ve0-f172.google.com with SMTP id b10so1566626vea.31 for ; Wed, 08 May 2013 02:53:18 -0700 (PDT) X-Received: by 10.58.227.104 with SMTP id rz8mr3831253vec.22.1368006798278; Wed, 08 May 2013 02:53:18 -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.58.127.98 with SMTP id nf2csp146840veb; Wed, 8 May 2013 02:53:17 -0700 (PDT) X-Received: by 10.194.19.104 with SMTP id d8mr9332599wje.24.1368006797363; Wed, 08 May 2013 02:53:17 -0700 (PDT) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [2a00:1450:400c:c05::233]) by mx.google.com with ESMTPS id ng4si1679238wic.108.2013.05.08.02.53.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 02:53:17 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::233 is neither permitted nor denied by best guess record for domain of steve.capper@linaro.org) client-ip=2a00:1450:400c:c05::233; Received: by mail-wi0-f179.google.com with SMTP id l13so1698268wie.6 for ; Wed, 08 May 2013 02:53:16 -0700 (PDT) X-Received: by 10.194.58.243 with SMTP id u19mr9266390wjq.47.1368006796810; Wed, 08 May 2013 02:53:16 -0700 (PDT) Received: from localhost.localdomain (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id m14sm8068040wij.9.2013.05.08.02.53.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 08 May 2013 02:53:16 -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: [RFC PATCH v2 06/11] ARM64: mm: Restore memblock limit when map_mem finished. Date: Wed, 8 May 2013 10:52:38 +0100 Message-Id: <1368006763-30774-7-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1368006763-30774-1-git-send-email-steve.capper@linaro.org> References: <1368006763-30774-1-git-send-email-steve.capper@linaro.org> X-Gm-Message-State: ALoCoQlAmfiax8gonRfwY0Sbp2PAw3QLGQxPV+zP41iH4JJF3zR5RUf3fqjMPmjqPGPcVVUvtws7 X-Original-Sender: steve.capper@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22c 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 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();