Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Isolate free pages onto a private freelist. If @strict is true, will abort* returning 0 on any invalid PFNs or non-free pages inside of the pageblock* (even though it may still end up isolating some pages).

Proto:static unsigned long isolate_freepages_block(struct compact_control *cc, unsigned long *start_pfn, unsigned long end_pfn, struct list_head *freelist, unsigned int stride, bool strict)

Type:unsigned long

Parameter:

TypeParameterName
struct compact_control *cc
unsigned long *start_pfn
unsigned longend_pfn
struct list_head *freelist
unsigned intstride
boolstrict
542  nr_scanned = 0 , total_isolated = 0
544  flags = 0
545  bool locked = false
546  blockpfn = start_pfn
550  If strict Then stride = 1
553  cursor = pfn_to_page(blockpfn)
556  When blockpfn < end_pfn cycle
558  page = cursor
565  If Not (blockpfn % SWAP_CLUSTER_MAX) && Compaction requires the taking of some coarse locks that are potentially* very heavily contended. The lock should be periodically unlocked to avoid* having disabled IRQs for a long time, even when there is nobody waiting on* the lock Then Break
570  nr_scanned++
571  If Not pfn_valid_within(blockpfn) Then Go to isolate_fail
580  If PageCompound(page) Then
584  blockpfn += (1UL << order) - 1
585  cursor += (1UL << order) - 1
587  Go to isolate_fail
590  If Not PageBuddy() indicates that the page is free and in the buddy system* (see mm/page_alloc.c). Then Go to isolate_fail
600  If Not locked Then
610  order = This function returns the order of a free page in the buddy system
611  isolated = __isolate_free_page(page, order)
612  If Not isolated Then Break
614  set_page_private(page, order)
616  total_isolated += isolated
617  Number of isolated free pages += isolated
618  list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
621  blockpfn += isolated
622  Break
625  blockpfn += isolated - 1
626  cursor += isolated - 1
627  Continue
629  isolate_fail :
630  If strict Then Break
632  Else Continue
637  If locked Then spin_unlock_irqrestore( & Primarily protects free_area , flags)
644  If Value for the false possibility is greater at compile time(blockpfn > end_pfn) Then blockpfn = end_pfn
647  trace_mm_compaction_isolate_freepages( * start_pfn, blockpfn, nr_scanned, total_isolated)
651  start_pfn = blockpfn
658  If strict && blockpfn < end_pfn Then total_isolated = 0
661  total_free_scanned += nr_scanned
662  If total_isolated Then count_compact_events(COMPACTISOLATED, total_isolated)
664  Return total_isolated
Caller
NameDescribe
isolate_freepages_rangesolate_freepages_range() - isolate free pages