函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称: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).

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

返回类型:unsigned long

参数:

类型参数名称
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  如果strictstride等于1
553  cursor等于pfn_to_page(blockpfn)
556 blockpfn小于end_pfn循环
558  page等于cursor
565  如果非blockpfnSWAP_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退出
570  nr_scanned自加
571  如果非pfn_valid_within(blockpfn)则转到:isolate_fail
580  如果PageCompound(page)则
581  order等于compound_order(page)
584  blockpfn加等于1UL左移order位的值减1
585  cursor加等于1UL左移order位的值减1
587  转到:isolate_fail
590  如果非PageBuddy() indicates that the page is free and in the buddy system* (see mm/page_alloc.c).则转到:isolate_fail
600  如果非locked
610  order等于This function returns the order of a free page in the buddy system
611  isolated等于__isolate_free_page(page, order)
612  如果非isolated退出
614  set_page_private(page, order)
616  total_isolated加等于isolated
617  Number of isolated free pages 加等于isolated
618  添加链表项
621  blockpfn加等于isolated
622  退出
625  blockpfn加等于isolated减1
626  cursor加等于isolated减1
627  继续下一循环
629  isolate_fail :
630  如果strict退出
632  否则继续下一循环
637  如果lockedspin_unlock_irqrestore( & 自旋锁, flags)
644  如果此条件成立可能性小(为编译器优化)(blockpfn > end_pfn)则blockpfn等于end_pfn
647  trace_mm_compaction_isolate_freepages( * start_pfn, blockpfn, nr_scanned, total_isolated)
651  start_pfn等于blockpfn
658  如果strictblockpfn小于end_pfntotal_isolated等于0
661  total_free_scanned加等于nr_scanned
662  如果total_isolatedcount_compact_events(COMPACTISOLATED, total_isolated)
664  返回:total_isolated
调用者
名称描述
isolate_freepages_rangesolate_freepages_range() - isolate free pages