Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'x86_mm_for_7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 mm updates from Dave Hansen:

- Convert x86 code to use generic "pagetable" APIs and ptdescs

This aligns some the set_memory*() code better with the new page
table APIs, especially using ptdescs as opposed to 'struct page'
directly.

* tag 'x86_mm_for_7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/mm/pat: Convert split_large_page() to use ptdescs
x86/mm/pat: Convert populate_pgd() to use page table apis
x86/mm/pat: Convert pmd code to use page table apis
x86/mm/pat: Convert pte code to use page table apis

+25 -12
+25 -12
arch/x86/mm/pat/set_memory.c
··· 1119 1119 1120 1120 static int 1121 1121 __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long address, 1122 - struct page *base) 1122 + struct ptdesc *ptdesc) 1123 1123 { 1124 1124 unsigned long lpaddr, lpinc, ref_pfn, pfn, pfninc = 1; 1125 + struct page *base = ptdesc_page(ptdesc); 1125 1126 pte_t *pbase = (pte_t *)page_address(base); 1126 1127 unsigned int i, level; 1127 1128 pgprot_t ref_prot; ··· 1227 1226 static int split_large_page(struct cpa_data *cpa, pte_t *kpte, 1228 1227 unsigned long address) 1229 1228 { 1230 - struct page *base; 1229 + struct ptdesc *ptdesc; 1231 1230 1232 1231 if (!debug_pagealloc_enabled()) 1233 1232 spin_unlock(&cpa_lock); 1234 - base = alloc_pages(GFP_KERNEL, 0); 1233 + ptdesc = pagetable_alloc(GFP_KERNEL, 0); 1235 1234 if (!debug_pagealloc_enabled()) 1236 1235 spin_lock(&cpa_lock); 1237 - if (!base) 1236 + if (!ptdesc) 1238 1237 return -ENOMEM; 1239 1238 1240 - if (__split_large_page(cpa, kpte, address, base)) 1241 - __free_page(base); 1239 + if (__split_large_page(cpa, kpte, address, ptdesc)) 1240 + pagetable_free(ptdesc); 1242 1241 1243 1242 return 0; 1244 1243 } ··· 1409 1408 if (!pte_none(pte[i])) 1410 1409 return false; 1411 1410 1412 - free_page((unsigned long)pte); 1411 + pte_free_kernel(&init_mm, pte); 1413 1412 return true; 1414 1413 } 1415 1414 ··· 1421 1420 if (!pmd_none(pmd[i])) 1422 1421 return false; 1423 1422 1424 - free_page((unsigned long)pmd); 1423 + pmd_free(&init_mm, pmd); 1425 1424 return true; 1426 1425 } 1427 1426 ··· 1540 1539 1541 1540 static int alloc_pte_page(pmd_t *pmd) 1542 1541 { 1543 - pte_t *pte = (pte_t *)get_zeroed_page(GFP_KERNEL); 1542 + pte_t *pte = pte_alloc_one_kernel(&init_mm); 1544 1543 if (!pte) 1545 1544 return -1; 1546 1545 ··· 1550 1549 1551 1550 static int alloc_pmd_page(pud_t *pud) 1552 1551 { 1553 - pmd_t *pmd = (pmd_t *)get_zeroed_page(GFP_KERNEL); 1552 + /* 1553 + * Pass 0 as a placeholder for the second argument, since the 1554 + * generic implementation of pmd_alloc_one() does not use it. 1555 + */ 1556 + pmd_t *pmd = pmd_alloc_one(&init_mm, 0); 1554 1557 if (!pmd) 1555 1558 return -1; 1556 1559 ··· 1748 1743 pgd_entry = cpa->pgd + pgd_index(addr); 1749 1744 1750 1745 if (pgd_none(*pgd_entry)) { 1751 - p4d = (p4d_t *)get_zeroed_page(GFP_KERNEL); 1746 + /* 1747 + * Pass 0 as a placeholder for the second argument, since the 1748 + * generic implementation of p4d_alloc_one() does not use it. 1749 + */ 1750 + p4d = p4d_alloc_one(&init_mm, 0); 1752 1751 if (!p4d) 1753 1752 return -1; 1754 1753 ··· 1764 1755 */ 1765 1756 p4d = p4d_offset(pgd_entry, addr); 1766 1757 if (p4d_none(*p4d)) { 1767 - pud = (pud_t *)get_zeroed_page(GFP_KERNEL); 1758 + /* 1759 + * Pass 0 as a placeholder for the second argument, since the 1760 + * generic implementation of pud_alloc_one() does not use it. 1761 + */ 1762 + pud = pud_alloc_one(&init_mm, 0); 1768 1763 if (!pud) 1769 1764 return -1; 1770 1765