Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\page_alloc.c Create Date:2022-07-28 15:06:01
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__alloc_pages_slowpath

Proto:static inline struct page *__alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, struct alloc_context *ac)

Type:struct page

Parameter:

TypeParameterName
gfp_tgfp_mask
unsigned intorder
struct alloc_context *ac
4393  can_direct_reclaim = gfp_mask & Caller can reclaim
4394  costly_order = order > PAGE_ALLOC_COSTLY_ORDER is the order at which allocations are deemed* costly to service. That is between allocation orders which should* coalesce naturally under reasonable reclaim pressure and those which* will not.
4395  struct page * page = NULL
4409  If WARN_ON_ONCE((gfp_mask & (DOC: Watermark modifiers* Watermark modifiers -- controls access to emergency reserves* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* %__GFP_HIGH indicates that the caller is high-priority and that granting | Caller can reclaim )) == (DOC: Watermark modifiers* Watermark modifiers -- controls access to emergency reserves* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* %__GFP_HIGH indicates that the caller is high-priority and that granting | Caller can reclaim )) Then gfp_mask &= ~DOC: Watermark modifiers* Watermark modifiers -- controls access to emergency reserves* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* %__GFP_HIGH indicates that the caller is high-priority and that granting
4413  retry_cpuset :
4414  compaction_retries = 0
4415  no_progress_loops = 0
4416  compact_priority = DEF_COMPACT_PRIORITY
4417  cpuset_mems_cookie = read_mems_allowed_begin()
4424  alloc_flags = gfp_to_alloc_flags(gfp_mask)
4432  preferred_zoneref = - Zoneref pointer for the first suitable zone found (see below)
4434  If Not Pointer to actual zone Then Go to nopage
4437  If alloc_flags & allow waking of kswapd Then wake_all_kswapds(order, gfp_mask, ac)
4444  page = get_page_from_freelist goes through the zonelist trying to allocate* a page.
4445  If page Then Go to got_pg
4457  If can_direct_reclaim && (costly_order || order > 0 && migratetype != MIGRATE_MOVABLE ) && Not gfp_pfmemalloc_allowed(gfp_mask) Then
4461  page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, INIT_COMPACT_PRIORITY, & compact_result)
4465  If page Then Go to got_pg
4472  If costly_order && gfp_mask & __GFP_NORETRY Then
4503  retry :
4505  If alloc_flags & allow waking of kswapd Then wake_all_kswapds(order, gfp_mask, ac)
4508  reserve_flags = Distinguish requests which really need access to full memory* reserves from oom victims which can live with a portion of it
4509  If reserve_flags Then alloc_flags = reserve_flags
4517  If Not (alloc_flags & check for correct cpuset ) || reserve_flags Then
4518  nodemask = NULL
4519  preferred_zoneref = - Zoneref pointer for the first suitable zone found (see below)
4524  page = get_page_from_freelist goes through the zonelist trying to allocate* a page.
4525  If page Then Go to got_pg
4529  If Not can_direct_reclaim Then Go to nopage
4533  If flags & Allocating memory Then Go to nopage
4537  page = The really slow allocator path where we enter direct reclaim
4539  If page Then Go to got_pg
4543  page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, compact_priority, & compact_result)
4545  If page Then Go to got_pg
4549  If gfp_mask & __GFP_NORETRY Then Go to nopage
4556  If costly_order && Not (gfp_mask & __GFP_RETRY_MAYFAIL) Then Go to nopage
4559  If Checks whether it makes sense to retry the reclaim to make a forward progress* for the given allocation request.* We give up when we either have tried MAX_RECLAIM_RETRIES in a row* without success, or when we couldn't even meet the watermark if we Then Go to retry
4569  If did_some_progress > 0 && should_compact_retry(ac, order, alloc_flags, compact_result, & compact_priority, & compaction_retries) Then Go to retry
4577  If check_retry_cpuset(cpuset_mems_cookie, ac) Then Go to retry_cpuset
4581  page = __alloc_pages_may_oom(gfp_mask, order, ac, & did_some_progress)
4582  If page Then Go to got_pg
4586  If tsk_is_oom_victim(current process) && ( alloc_flags == Only MMU archs have async oom victim reclaim - aka oom_reaper so we* cannot assume a reduced access to memory reserves is sufficient for* !MMU || gfp_mask & __GFP_NOMEMALLOC ) Then Go to nopage
4592  If did_some_progress Then
4593  no_progress_loops = 0
4594  Go to retry
4597  nopage :
4599  If check_retry_cpuset(cpuset_mems_cookie, ac) Then Go to retry_cpuset
4606  If gfp_mask & __GFP_NOFAIL Then
4611  If WARN_ON_ONCE(!can_direct_reclaim) Then Go to fail
4619  WARN_ON_ONCE(flags & Allocating memory )
4627  WARN_ON_ONCE(order > PAGE_ALLOC_COSTLY_ORDER is the order at which allocations are deemed* costly to service. That is between allocation orders which should* coalesce naturally under reasonable reclaim pressure and those which* will not.)
4635  page = __alloc_pages_cpuset_fallback(gfp_mask, order, ry to alloc harder , ac)
4636  If page Then Go to got_pg
4639  cond_resched()
4640  Go to retry
4642  fail :
4643  warn_alloc(gfp_mask, nodemask, "page allocation failure: order:%u", order)
4645  got_pg :
4646  Return page
Caller
NameDescribe
__alloc_pages_nodemaskThis is the 'heart' of the zoned buddy allocator.