Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6127018ybi; Wed, 31 Jul 2019 08:47:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWj+DJ8zh8J9XESLcieEc35bjmUQ0WkmZN92m2IS5dP2jBni/8lGldtBVb9uzZhKRbDbGj X-Received: by 2002:aa7:8711:: with SMTP id b17mr48766120pfo.234.1564588031866; Wed, 31 Jul 2019 08:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564588031; cv=none; d=google.com; s=arc-20160816; b=wT7k63J1wRS7RIo89BgU8Ke9zoWN/f5mJxyfaY84wQX/PDbCHwPYGPgwtOnY7zKs7X en7W1S2zCtKUAItnC3IIENgUtTWUlRqsNs/g7Qe/DLx3MvjUhjs+vdCvEFeaPbKnVadi kJinwkjE9rpYg9AE7EJjzzaRhvNBacaj0W1OVy5q/F2jk7+8Pi/Ff/QFfM/ZIY+1DxrK pi7Neg7xyce8bbva8u2xcZ84Q7MPiAonaREyD9hmLM5h7KZT4c/uwKQ8aY+gJX0FJXO5 ySB8rnRLn/qxWyvXCyVtJVGPEiKcYme8bHC3vf6rAKHBJacntBfrzr/0Vn19CqcUFkBD H3+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=BddmaCO7bOzK4AWOjB15c/2T2Rs12mf6BHbqywMmVkc=; b=XIfQL8kO0G8epy6wUBc/Oz1gqjMwD9SNZxc7JP/70bk9PoB3jPfPW1uIj3p3le9kda pjnVGljDG9AEJJO9A0FktqccS1IUJ9paI3ZfDFj16aGBNIahxNIMUv+9vDss5kjbIh2W cc0Qv1ymuca/6pxO9xZ9oxMNBL3uLO1YyQYsncqUZZyCQ6H6LSip2X6/rCMpIyjaxZQ4 WtOpf0rFRLp5RIUmVP6xqbv3Eapx44Ff5B3K31d7jA8a0V+zos1rO3BpP5obKzMdtlKo PRGPt3stWFLLn65FqsDw1DStHV4WXFlbz8K3SphL7omeeUomr31fFxTeSMEcqltfSLVz qbPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si29430011pls.391.2019.07.31.08.46.56; Wed, 31 Jul 2019 08:47:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729069AbfGaPqP (ORCPT + 99 others); Wed, 31 Jul 2019 11:46:15 -0400 Received: from foss.arm.com ([217.140.110.172]:49482 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbfGaPqO (ORCPT ); Wed, 31 Jul 2019 11:46:14 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7E38C1570; Wed, 31 Jul 2019 08:46:14 -0700 (PDT) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CE3F73F694; Wed, 31 Jul 2019 08:46:11 -0700 (PDT) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Andrew Morton , Mark Rutland Subject: [PATCH v10 01/22] mm: Add generic p?d_leaf() macros Date: Wed, 31 Jul 2019 16:45:42 +0100 Message-Id: <20190731154603.41797-2-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731154603.41797-1-steven.price@arm.com> References: <20190731154603.41797-1-steven.price@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Exposing the pud/pgd levels of the page tables to walk_page_range() means we may come across the exotic large mappings that come with large areas of contiguous memory (such as the kernel's linear map). For architectures that don't provide all p?d_leaf() macros, provide generic do nothing default that are suitable where there cannot be leaf pages at that level. Futher patches will add implementations for individual architectures. The name p?d_leaf() is chosen to minimize the confusion with existing uses of "large" pages and "huge" pages which do not necessary mean that the entry is a leaf (for example it may be a set of contiguous entries that only take 1 TLB slot). For the purpose of walking the page tables we don't need to know how it will be represented in the TLB, but we do need to know for sure if it is a leaf of the tree. Signed-off-by: Steven Price Acked-by: Mark Rutland --- include/asm-generic/pgtable.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 75d9d68a6de7..d3d868ad21b2 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -1188,4 +1188,24 @@ static inline bool arch_has_pfn_modify_check(void) #define mm_pmd_folded(mm) __is_defined(__PAGETABLE_PMD_FOLDED) #endif +/* + * p?d_leaf() - true if this entry is a final mapping to a physical address. + * This differs from p?d_huge() by the fact that they are always available (if + * the architecture supports large pages at the appropriate level) even + * if CONFIG_HUGETLB_PAGE is not defined. + * Only meaningful when called on a valid entry. + */ +#ifndef pgd_leaf +#define pgd_leaf(x) 0 +#endif +#ifndef p4d_leaf +#define p4d_leaf(x) 0 +#endif +#ifndef pud_leaf +#define pud_leaf(x) 0 +#endif +#ifndef pmd_leaf +#define pmd_leaf(x) 0 +#endif + #endif /* _ASM_GENERIC_PGTABLE_H */ -- 2.20.1