Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:get_page_from_freelist goes through the zonelist trying to allocate* a page.

Proto:static struct page *get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags, const struct alloc_context *ac)

Type:struct page

Parameter:

TypeParameterName
gfp_tgfp_mask
unsigned intorder
intalloc_flags
const struct alloc_context *ac
3574  struct pglist_data * last_pgdat_dirty_limit = NULL
3577  retry :
3582  no_fallback = alloc_flags & ALLOC_NOFRAGMENT
3583  z = preferred_zoneref
3589  If cpusets_enabled() && alloc_flags & check for correct cpuset && Not __cpuset_zone_allowed(zone, gfp_mask) Then Continue
3612  If spread_dirty_pages Then
3613  If last_pgdat_dirty_limit == zone_pgdat Then Continue
3618  Continue
3622  If no_fallback && nr_online_nodes > 1 && zone != Pointer to actual zone Then
3631  local_nid = zone_to_nid(Pointer to actual zone )
3632  If zone_to_nid(zone) != local_nid Then
3634  Go to retry
3638  mark = wmark_pages(zone, alloc_flags & Mask to get the watermark bits )
3639  If Not zone_watermark_fast(zone, order, mark, ac_classzone_idx(ac), alloc_flags) Then
3654  BUILD_BUG_ON - break compile if a condition is true(don't check watermarks at all < NR_WMARK)
3655  If alloc_flags & don't check watermarks at all Then Go to try_this_zone
3658  If Node reclaim mode* If non-zero call node_reclaim when the number of free pages falls below* the watermarks. == 0 || Not zone_allows_reclaim(Pointer to actual zone , zone) Then Continue
3662  ret = node_reclaim(zone_pgdat, gfp_mask, order)
3664  Case ret == NODE_RECLAIM_NOSCAN
3666  Continue
3667  Case ret == NODE_RECLAIM_FULL
3669  Continue
3670  Default
3676  Continue
3680  try_this_zone :
3681  page = Allocate a page from the given zone. Use pcplists for order-0 allocations.
3683  If page Then
3684  prep_new_page(page, order, gfp_mask, alloc_flags)
3690  If Value for the false possibility is greater at compile time(order && (alloc_flags & ry to alloc harder )) Then Reserve a pageblock for exclusive use of high-order atomic allocations if* there are no empty page blocks that contain a page with a suitable order
3693  Return page
3694  Else
3709  If no_fallback Then
3710  alloc_flags &= ~ALLOC_NOFRAGMENT
3711  Go to retry
3714  Return NULL
Caller
NameDescribe
__alloc_pages_cpuset_fallback
__alloc_pages_may_oom
__alloc_pages_direct_reclaimThe really slow allocator path where we enter direct reclaim
__alloc_pages_slowpath
__alloc_pages_nodemaskThis is the 'heart' of the zoned buddy allocator.