Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Freeing function for a buddy system allocator

Proto:static inline void __free_one_page(struct page *page, unsigned long pfn, struct zone *zone, unsigned int order, int migratetype)

Type:void

Parameter:

TypeParameterName
struct page *page
unsigned longpfn
struct zone *zone
unsigned intorder
intmigratetype
903  buddy_pfn = buddy_pfn
906  capc = task_capc(zone)
908  max_order = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedint, Free memory management - zoned buddy allocator. , Huge pages are a constant size + 1)
910  VM_BUG_ON(!zone_is_initialized(zone))
911  VM_BUG_ON_PAGE( Atomic flags, some possibly * updated asynchronously & Flags checked when a page is prepped for return by the page allocator, page)
913  VM_BUG_ON(migratetype == - 1)
914  If Value is more likely to compile time(!is_migrate_isolate(migratetype)) Then __mod_zone_freepage_state(zone, 1 << order, migratetype)
917  VM_BUG_ON_PAGE(pfn & ((1 << order) - 1), page)
918  VM_BUG_ON_PAGE(bad_range(zone, page), page)
920  continue_merging :
921  When order < max_order - 1 cycle
925  Return
927  buddy_pfn = Locate the struct page for both the matching buddy in our* pair (buddy1) and the combined O(n+1) page they form (page)
928  buddy = page + buddy_pfn - pfn
930  If Not pfn_valid_within(buddy_pfn) Then Go to done_merging
932  If Not This function checks whether a page is free && is the buddy* we can coalesce a page and its buddy if* (a) the buddy is not in a hole (check before calling!) &&* (b) the buddy is in the buddy system &&* (c) a page and its buddy have the same order && Then Go to done_merging
938  If page_is_guard(buddy) Then clear_page_guard(zone, buddy, order, migratetype)
940  Else del_page_from_free_area(buddy, & Write-intensive fields used from the page allocator [order])
942  combined_pfn = buddy_pfn & pfn
943  page = page + combined_pfn - pfn
944  pfn = combined_pfn
945  order++
947  If max_order < Free memory management - zoned buddy allocator. Then
960  buddy = page + buddy_pfn - pfn
968  max_order++
969  Go to continue_merging
972  done_merging :
973  set_page_order(page, order)
983  If order < Free memory management - zoned buddy allocator. - 2 && pfn_valid_within(buddy_pfn) && Not is_shuffle_order(order) Then
986  combined_pfn = buddy_pfn & pfn
987  higher_page = page + combined_pfn - pfn
988  buddy_pfn = Locate the struct page for both the matching buddy in our* pair (buddy1) and the combined O(n+1) page they form (page)
989  higher_buddy = higher_page + buddy_pfn - combined_pfn
994  Return
998  If is_shuffle_order(order) Then add_to_free_area_random(page, & Write-intensive fields used from the page allocator [order], migratetype)
1001  Else Used for pages not on another list
Caller
NameDescribe
free_pcppages_bulkFrees a number of pages from the PCP lists* Assumes all pages on list are in same zone, and of same order.* count is the number of pages to free.* If the zone was previously in an "all pages pinned" state then look to
free_one_page