GFP means Get Free Page
GFP bitmasks are at include/linux/gfp.h
This file has clear description for each kind of flags.
Some important Macros
#define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
- The virt_to_page(addr) macro yields the address of the page descriptor associated with the linear address addr .
- The pfn_to_page(pfn) macro yields the address of the page descriptor associated with the page frame having number pfn .
- #define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET)) ,#define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
- #define __pa(x) __phys_addr((unsigned long)(x))
- The structure of page descriptor is at include/linux/mm_types.h
arch/x86/include/asm/pgtable_64_types.h
#define SHARED_KERNEL_PMD 0
//PGDIR_SHIFT determines what a top-level page table entry can map
#define PGDIR_SHIFT 39
#define PTRS_PER_PGD 512
//3rd level page
#define PUD_SHIFT 30
#define PTRS_PER_PUD 512
//PMD_SHIFT determines the size of the area a middle-level page table can map
#define PMD_SHIFT 21
#define PTRS_PER_PMD 512
//entries per page directory level
#define PTRS_PER_PTE 512
/* See Documentation/x86/x86_64/mm.txt for a description of the memory map. */
#define MAXMEM _AC(__AC(1, UL) << MAX_PHYSMEM_BITS, UL)
#define VMALLOC_SIZE_TB _AC(32, UL)
#define __VMALLOC_BASE _AC(0xffffc90000000000, UL)