Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Allocate a page from the given zone. Use pcplists for order-0 allocations.

Proto:static inline struct page *rmqueue(struct zone *preferred_zone, struct zone *zone, unsigned int order, gfp_t gfp_flags, unsigned int alloc_flags, int migratetype)

Type:struct page

Parameter:

TypeParameterName
struct zone *preferred_zone
struct zone *zone
unsigned intorder
gfp_tgfp_flags
unsigned intalloc_flags
intmigratetype
3262  If Value is more likely to compile time(order == 0) Then
3263  page = Lock and remove page from the per-cpu list
3265  Go to out
3272  WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1))
3273  spin_lock_irqsave( & Primarily protects free_area , flags)
3275  Do
3276  page = NULL
3282  If Not page Then page = Do the hard work of removing an element from the buddy allocator.* Call me with the zone->lock already held.
3284  When page && check_new_pages(page, order) cycle
3285  spin_unlock( & Primarily protects free_area )
3286  If Not page Then Go to failed
3288  __mod_zone_freepage_state(zone, - (1 << order), A cached value of the page's pageblock's migratetype, used when the page is* put on a pcplist)
3291  __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order)
3292  Update NUMA hit/miss statistics* Must be called with interrupts disabled.
3293  local_irq_restore(flags)
3295  out :
3297  If st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from Then
3298  lear_bit - Clears a bit in memory*@nr: Bit to clear*@addr: Address to start counting from* This is a relaxed atomic operation (no implied memory barriers).
3299  A zone is low on free memory or too fragmented for high-order memory
3302  VM_BUG_ON_PAGE(page && bad_range(zone, page), page)
3303  Return page
3305  failed :
3306  local_irq_restore(flags)
3307  Return NULL
Caller
NameDescribe
get_page_from_freelistget_page_from_freelist goes through the zonelist trying to allocate* a page.