Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:free_pages_prepare

Proto:static __always_inline bool free_pages_prepare(struct page *page, unsigned int order, bool check_free)

Type:bool

Parameter:

TypeParameterName
struct page *page
unsigned intorder
boolcheck_free
1124  bad = 0
1126  VM_BUG_ON_PAGE(PageTail(page), page)
1128  trace_mm_page_free(page, order)
1134  If Value for the false possibility is greater at compile time(order) Then
1135  compound = PageCompound(page)
1138  VM_BUG_ON_PAGE(compound && compound_order(page) != order, page)
1140  If compound Then ClearPageDoubleMap(page)
1142  When i < 1 << order cycle
1143  If compound Then bad += free_tail_pages_check(page, page + i)
1146  bad++
1147  Continue
1152  If PageMappingFlags(page) Then See page-flags.h for PAGE_MAPPING_FLAGS = NULL
1154  If memcg_kmem_enabled() && If kmemcg is enabled, the buddy allocator will set PageKmemcg() on* pages allocated with __GFP_ACCOUNT. It gets cleared on page free. Then __memcg_kmem_uncharge(page, order)
1156  If check_free Then bad += free_pages_check(page)
1158  If bad Then Return false
1161  page_cpupid_reset_last(page)
1162  Atomic flags, some possibly * updated asynchronously &= ~Flags checked when a page is prepped for return by the page allocator
1163  reset_page_owner(page, order)
1165  If Not PageHighMem(page) Then
1166  Called when kernel memory is freed (or unmapped), or if a lock* is destroyed or reinitialized - this code checks whether there is* any held lock in the memory range of to :
1168  debug_check_no_obj_freed(page_address(page), PAGE_SIZE << order)
1171  If want_init_on_free() Then kernel_init_free_pages(page, 1 << order)
1174  kernel_poison_pages(page, 1 << order, 0)
1180  arch_free_page(page, order)
1182  If For use in fast paths after init_debug_pagealloc() has run, or when a* false negative result is not harmful when called too early. Then kernel_map_pages(page, 1 << order, 0)
1185  kasan_free_nondeferred_pages(page, order)
1187  Return true
Caller
NameDescribe
free_pcp_prepareWith DEBUG_VM disabled, order-0 pages being freed are checked only when* moving from pcp lists to free list in order to reduce overhead. With* debug_pagealloc enabled, they are checked also immediately when being freed* to the pcp lists.
__free_pages_ok