函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\page_alloc.c Create Date:2022-07-27 16:36:17
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:This is the 'heart' of the zoned buddy allocator.

函数原型:struct page *__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, nodemask_t *nodemask)

返回类型:struct page

参数:

类型参数名称
gfp_tgfp_mask
unsigned intorder
intpreferred_nid
nodemask_t *nodemask
4704  alloc_flags等于ALLOC_WMARK_LOW
4706  struct alloc_context ac = {}
4712  如果此条件成立可能性小(为编译器优化)(order >= Free memory management - zoned buddy allocator. )则
4713  WARN_ON_ONCE(!(gfp_mask & DOC: Action modifiers* Action modifiers* ~~~~~~~~~~~~~~~~* %__GFP_NOWARN suppresses allocation failure reports.* %__GFP_COMP address compound page metadata.* %__GFP_ZERO returns a zeroed page on success.))
4714  返回:NULL
4717  gfp_mask与等于gfp_allowed_mask
4718  alloc_mask等于gfp_mask
4719  如果非prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, & ac, & alloc_mask, & alloc_flags)则返回:NULL
4722  Determine whether to spread dirty pages and what the first usable zone
4728  alloc_flags或等于The restriction on ZONE_DMA32 as being a suitable zone to use to avoid* fragmentation is subtle. If the preferred zone was HIGHMEM then* premature use of a lower zone may cause lowmem pressure problems that* are worse than fragmentation
4731  page等于get_page_from_freelist goes through the zonelist trying to allocate* a page.
4732  如果此条件成立可能性大(为编译器优化)(page)则转到:out
4741  alloc_mask等于Applies per-task gfp context to the given allocation flags.* PF_MEMALLOC_NOIO implies GFP_NOIO* PF_MEMALLOC_NOFS implies GFP_NOFS* PF_MEMALLOC_NOCMA implies no allocation from CMA region.
4742  spread_dirty_pages = false
4748  如果此条件成立可能性小(为编译器优化)(nodemask != nodemask)则nodemask等于nodemask
4751  page等于__alloc_pages_slowpath(alloc_mask, order, & ac)
4753  out :
4754  如果memcg_kmem_enabled()且gfp_mask按位与__GFP_ACCOUNTpage此条件成立可能性小(为编译器优化)(__memcg_kmem_charge(page, gfp_mask, order) != 0)则
4756  __free_pages(page, order)
4757  page = NULL
4760  trace_mm_page_alloc(page, order, alloc_mask, migratetype)
4762  返回:page
调用者
名称描述
alloc_buddy_huge_page
alloc_pages_vmaalloc_pages_vma - Allocate a page for a VMA.*@gfp:* %GFP_USER user allocation.* %GFP_KERNEL kernel allocations,* %GFP_HIGHMEM highmem/user allocations,* %GFP_FS allocation should not call back into a file system.* %GFP_ATOMIC don't sleep.
alloc_pages_currentalloc_pages_current - Allocate pages.*@gfp:* %GFP_USER user allocation,* %GFP_KERNEL kernel allocation,* %GFP_HIGHMEM highmem allocation,* %GFP_FS don't call back into a file system.* %GFP_ATOMIC don't sleep.
new_page_nodemask