Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp622217ybx; Fri, 1 Nov 2019 08:38:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxx8cSlOkrnmRnbSFmx255iTirTLexyihib87p9r1n8JtSPyrXfMTssJTFIBAOuaoGIXmZf X-Received: by 2002:aa7:cd59:: with SMTP id v25mr13415448edw.26.1572622717042; Fri, 01 Nov 2019 08:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572622717; cv=none; d=google.com; s=arc-20160816; b=kPP4uaEkQ8yok4vGA2AhlG9CCpVej/2JgObs8tN3sklcj88/Qo7nqUIfAqA90gwq5B kkM+XaS/2S4MUrEzv4hWjy5fhiEt+xsnbjX+f/AO5DEs+1QHS5qqyPlk0w+qAeDd8BUd 7K5to5wn2ImCX8ZjJ1Cdk0T/B9+bWxBTKvQv6I5ZaZpQ0d8q4IsVD4jYChbNyeFrBkH5 bsia68Ws1vJq9YxS9KHgyaQ12hWjttCK0antAY1r6RDu10i/48Xn379AkyCmhjJHwR9N c2G8JtvHRcdPeVM0Hij4sDjwRIj6o3cHzYyAHmgG1sYbv4HHbE2WoVLX+QtD2++uA1Tc zn8w== 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=9SqGl5CrTKprCTfXLRy7V0fEcdpEU1lW3cyJ8+roEes=; b=Dbf1zVhRUskSw7Y3mx7V++OuURhQihc84i8/ztKQiOjZqdU6L55ZsohGZMIWtNrILq PeBIkaedLjxih37NRpXlmLUp957oAicY+VrqqHMzv4IbSlguWZJqGxHBBFYZU3swjVeq lpbB8M+EVrSQBmRGyhmoqDUemJiKgKX8NDlUfubGxJocjuifZLM+IvbTiftJluU5KYZF WOY6HbzpUisyKHzvksF3ngKROUvknzqjTWfWT4tBF4gfJzRoLm/YGTuFx9gCKMETqSLd DJv1CVh3rHm2UH4lDnDWBQMDG49r/oUZmraBuj+uo6JJ8IhT/ju2LLeCExyOPPlPDjlt qgkQ== 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 f2si650111eda.339.2019.11.01.08.38.13; Fri, 01 Nov 2019 08:38:37 -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 S1728043AbfKAOJ5 (ORCPT + 99 others); Fri, 1 Nov 2019 10:09:57 -0400 Received: from foss.arm.com ([217.140.110.172]:35838 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727725AbfKAOJ4 (ORCPT ); Fri, 1 Nov 2019 10:09:56 -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 BE5F2328; Fri, 1 Nov 2019 07:09:55 -0700 (PDT) Received: from e112269-lin.cambridge.arm.com (e112269-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1779C3F718; Fri, 1 Nov 2019 07:09:52 -0700 (PDT) From: Steven Price To: Andrew Morton , 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" , Mark Rutland Subject: [PATCH v15 01/23] mm: Add generic p?d_leaf() macros Date: Fri, 1 Nov 2019 14:09:20 +0000 Message-Id: <20191101140942.51554-2-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191101140942.51554-1-steven.price@arm.com> References: <20191101140942.51554-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 818691846c90..7f9eced287b7 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -1187,4 +1187,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