From patchwork Fri Nov 21 08:27:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhichang.yuan@linaro.org X-Patchwork-Id: 5353431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9EB029F2F1 for ; Fri, 21 Nov 2014 08:31:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1F6C20122 for ; Fri, 21 Nov 2014 08:31:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEE9B20109 for ; Fri, 21 Nov 2014 08:31:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XrjZP-0004WH-EW; Fri, 21 Nov 2014 08:27:59 +0000 Received: from mail-pd0-f181.google.com ([209.85.192.181]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XrjZM-0004VM-JY for linux-arm-kernel@lists.infradead.org; Fri, 21 Nov 2014 08:27:57 +0000 Received: by mail-pd0-f181.google.com with SMTP id z10so4828379pdj.12 for ; Fri, 21 Nov 2014 00:27:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=mvuCns1dTUi5i5rMNP8lowWG6r+g6KemWlFCUL5XV0Y=; b=E0uCX98sw4WHl7Yw7tm0Hm5cMm7nZGKBxyrWzD4Fa+Tp/0LWY5fwsxDhzq1FIeG6A5 RP421TBcjDhEZPdiqGq0ixdZ7AC8/wYW85i4Gak0Dh2EFZBRTImUi/jeMH+mbR+rX71e VpYdljQIIPbnJWpbdCu3BEZqjUU4Pyea6hA5blTUUAKsfErS6Z+wEZUl3rIue1zdgCUT eVI+sv9YCBlBck+3Qq89D53LdRSXPjJ4jZrM1fhwUT2OuCId3X9xNekLNTlrrn2uNo0O S2Eweu31PkWL7yMkK/4WcPTRWQG3y4Se1tOr7dzSS3aiXS0sNgxLrzWNbktVyBmHlMxP NiSA== X-Gm-Message-State: ALoCoQmJKTtr1ABC+lfroPMZZpzD0Z5CBN0XRYBQxqt7GLDuYd28WwI+HtNbDEyq5Sj68m7943ox X-Received: by 10.70.37.8 with SMTP id u8mr4670359pdj.9.1416558452767; Fri, 21 Nov 2014 00:27:32 -0800 (PST) Received: from localhost ([58.251.159.252]) by mx.google.com with ESMTPSA id b16sm4087326pdl.56.2014.11.21.00.27.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 21 Nov 2014 00:27:31 -0800 (PST) From: zhichang.yuan@linaro.org To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH] arm64:mm: free the useless initial page table Date: Fri, 21 Nov 2014 16:27:40 +0800 Message-Id: <1416558460-7257-1-git-send-email-zhichang.yuan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141121_002756_674933_237822D8 X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: dsaxena@linaro.org, liguozhu@huawei.com, "zhichang.yuan" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "zhichang.yuan" For 64K page system, after mapping a PMD section, the corresponding initial page table is not needed any more. That page can be freed. Signed-off-by: Zhichang Yuan --- arch/arm64/mm/mmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index f4f8b50..12a336b 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -191,8 +191,11 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, * Check for previous table entries created during * boot (__create_page_tables) and flush them. */ - if (!pmd_none(old_pmd)) + if (!pmd_none(old_pmd)) { flush_tlb_all(); + if (pmd_table(old_pmd)) + memblock_free(pte_pfn(pmd_pte(old_pmd)) << PAGE_SHIFT, PAGE_SIZE); + } } else { alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys), prot_pte);