[PATCH -next] arm64/mm: fix a bogus GFP flag in pgd_alloc()

From: Qian Cai
Date: Tue Jun 04 2019 - 10:05:08 EST


The commit "arm64: switch to generic version of pte allocation"
introduced endless failures during boot like,

kobject_add_internal failed for pgd_cache(285:chronyd.service) (error:
-2 parent: cgroup)

It turns out __GFP_ACCOUNT is passed to kernel page table allocations
and then later memcg finds out those don't belong to any cgroup.

backtrace:
kobject_add_internal
kobject_init_and_add
sysfs_slab_add+0x1a8
__kmem_cache_create
create_cache
memcg_create_kmem_cache
memcg_kmem_cache_create_func
process_one_work
worker_thread
kthread

Signed-off-by: Qian Cai <cai@xxxxxx>
---
arch/arm64/mm/pgd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c
index 769516cb6677..53c48f5c8765 100644
--- a/arch/arm64/mm/pgd.c
+++ b/arch/arm64/mm/pgd.c
@@ -38,7 +38,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
if (PGD_SIZE == PAGE_SIZE)
return (pgd_t *)__get_free_page(gfp);
else
- return kmem_cache_alloc(pgd_cache, gfp);
+ return kmem_cache_alloc(pgd_cache, GFP_PGTABLE_KERNEL);
}

void pgd_free(struct mm_struct *mm, pgd_t *pgd)
--
1.8.3.1