[PATCH] mm: Introduce GFP_PGTABLE
Anshuman Khandual
anshuman.khandual at arm.com
Mon Jan 14 15:14:05 AEDT 2019
On 01/12/2019 10:18 PM, Shakeel Butt wrote:
>> --- a/arch/x86/kernel/espfix_64.c
>> +++ b/arch/x86/kernel/espfix_64.c
>> @@ -57,8 +57,6 @@
>> # error "Need more virtual address space for the ESPFIX hack"
>> #endif
>>
>> -#define PGALLOC_GFP (GFP_KERNEL | __GFP_ZERO)
>> -
>> /* This contains the *bottom* address of the espfix stack */
>> DEFINE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack);
>> DEFINE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr);
>> @@ -172,7 +170,7 @@ void init_espfix_ap(int cpu)
>> pud_p = &espfix_pud_page[pud_index(addr)];
>> pud = *pud_p;
>> if (!pud_present(pud)) {
>> - struct page *page = alloc_pages_node(node, PGALLOC_GFP, 0);
>> + struct page *page = alloc_pages_node(node, GFP_PGTABLE, 0);
>>
>> pmd_p = (pmd_t *)page_address(page);
>> pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask));
>> @@ -184,7 +182,7 @@ void init_espfix_ap(int cpu)
>> pmd_p = pmd_offset(&pud, addr);
>> pmd = *pmd_p;
>> if (!pmd_present(pmd)) {
>> - struct page *page = alloc_pages_node(node, PGALLOC_GFP, 0);
>> + struct page *page = alloc_pages_node(node, GFP_PGTABLE, 0);
>>
>> pte_p = (pte_t *)page_address(page);
>> pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask));
>> diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
>> index 7bd0170..d608b03 100644
>> --- a/arch/x86/mm/pgtable.c
>> +++ b/arch/x86/mm/pgtable.c
>> @@ -13,19 +13,17 @@ phys_addr_t physical_mask __ro_after_init = (1ULL << __PHYSICAL_MASK_SHIFT) - 1;
>> EXPORT_SYMBOL(physical_mask);
>> #endif
>>
>> -#define PGALLOC_GFP (GFP_KERNEL_ACCOUNT | __GFP_ZERO)
>> -
> You have silently dropped __GFP_ACCOUNT from all the allocations in this file.
Right, they need to be added back explicitly after GFP_PGTABLE. Matthew had
pointed this earlier. Will fix it next time around.
>
> BTW why other archs not using __GFP_ACCOUNT for the user page tables?
>
Some archs do and some dont. User page tables pages should use __GFP_ACCOUNT
for allocation. I am working on fixing it for arm64.
More information about the Linuxppc-dev
mailing list