函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Allocate a page from the given zone. Use pcplists for order-0 allocations.

函数原型: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)

返回类型:struct page

参数:

类型参数名称
struct zone *preferred_zone
struct zone *zone
unsigned intorder
gfp_tgfp_flags
unsigned intalloc_flags
intmigratetype
3262  如果此条件成立可能性大(为编译器优化)(order == 0)则
3263  page等于Lock and remove page from the per-cpu list
3265  转到:out
3272  WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1))
3273  spin_lock_irqsave( & 自旋锁, flags)
3275  循环
3276  page = NULL
3277  如果alloc_flags按位与ry to alloc harder
3282  如果非pagepage等于Do the hard work of removing an element from the buddy allocator.* Call me with the zone->lock already held.
3284 pagecheck_new_pages(page, order)循环
3285  自旋锁解锁
3286  如果非page则转到: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  如果st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from
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  返回:page
3305  failed :
3306  local_irq_restore(flags)
3307  返回:NULL
调用者
名称描述
get_page_from_freelistget_page_from_freelist goes through the zonelist trying to allocate* a page.