[PATCH] mm: vmalloc: make vmalloc_to_page() deal with PMD/PUD mappings

From
Dave Hansen <hidden>
Date
2017-06-02 14:29:46
Also in
linux-mm
Reply to
Ard Biesheuvel, 2017-06-02
On 06/02/2017 04:27 AM, Ard Biesheuvel wrote:
quoted hunk ↗ jump to hunk
+static struct page *vmalloc_to_pud_page(unsigned long addr, pud_t *pud)
+{
+	struct page *page = NULL;
+#ifdef CONFIG_HUGETLB_PAGE
Do we really want this based on hugetlbfs?  Won't this be dead code on x86?

Also, don't we discourage #ifdefs in .c files?
quoted hunk ↗ jump to hunk
+	pte_t pte = huge_ptep_get((pte_t *)pud);
+
+	if (pte_present(pte))
+		page = pud_page(*pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
x86 has pmd/pud_page().  Seems a bit silly to open-code it here.
quoted hunk ↗ jump to hunk
+#else
+	VIRTUAL_BUG_ON(1);
+#endif
+	return page;
+}
So if somebody manages to call this function on a huge page table entry,
but doesn't have hugetlbfs configured on, we kill the machine?
Thread (8 messages) 8 messages, 3 authors, last reply 2017-06-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help