xref: /linux/arch/powerpc/include/asm/pgalloc.h (revision bc686442f8a601bccac1f22506ecdb4b0d62cadd)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_PGALLOC_H
3 #define _ASM_POWERPC_PGALLOC_H
4 
5 #include <linux/mm.h>
6 
7 #ifndef MODULE
8 static inline gfp_t pgtable_gfp_flags(struct mm_struct *mm, gfp_t gfp)
9 {
10 	if (unlikely(mm == &init_mm))
11 		return gfp;
12 	return gfp | __GFP_ACCOUNT;
13 }
14 #else /* !MODULE */
15 static inline gfp_t pgtable_gfp_flags(struct mm_struct *mm, gfp_t gfp)
16 {
17 	return gfp | __GFP_ACCOUNT;
18 }
19 #endif /* MODULE */
20 
21 #define PGALLOC_GFP (GFP_KERNEL | __GFP_ZERO)
22 
23 #ifdef CONFIG_PPC_BOOK3S
24 #include <asm/book3s/pgalloc.h>
25 #else
26 #include <asm/nohash/pgalloc.h>
27 #endif
28 
29 #endif /* _ASM_POWERPC_PGALLOC_H */
30