函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\vmscan.c Create Date:2022-07-27 15:42:22
Last Modify:2022-05-23 13:41:30 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:shrink_inactive_list() is a helper for shrink_node(). It returns the number* of reclaimed pages

函数原型:static __attribute__((__noinline__)) unsigned long shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec, struct scan_control *sc, enum lru_list lru)

返回类型:unsigned long

参数:

类型参数名称
unsigned longnr_to_scan
struct lruvec *lruvec
struct scan_control *sc
enum lru_listlru
1916  LIST_HEAD(page_list)
1918  nr_reclaimed等于0
1921  file等于is_file_lru(lru)
1923  pgdat等于lruvec_pgdat(lruvec)
1924  reclaim_stat等于reclaim_stat
1925  bool stalled = false
1927 此条件成立可能性小(为编译器优化)(A direct reclaimer may isolate SWAP_CLUSTER_MAX pages from the LRU list and* then get rescheduled)循环
1928  如果stalled则返回:0
1932  msleep - sleep safely even with waitqueue interruptions*@msecs: Time in milliseconds to sleep for
1933  stalled = true
1936  如果fatal_signal_pending(当前进程)则返回:SWAP_CLUSTER_MAX
1940  lru_add_drain()
1942  spin_lock_irq( & Write-intensive fields used by page reclaim )
1944  nr_taken等于pgdat->lru_lock is heavily contended. Some of the functions that* shrink the lists perform better by taking out a batch of pages* and working on them outside the LRU lock.* For pagecache intensive workloads, this function is the hottest
1947  __mod_node_page_state(pgdat, NR_ISOLATED_ANON + file, nr_taken)
1948  recent_scanned[file]加等于nr_taken
1950  item等于如果current_is_kswapd()则PGSCAN_KSWAPD否则PGSCAN_DIRECT
1951  如果非cgroup_reclaim(sc)则__count_vm_events(item, nr_scanned)
1953  __count_memcg_events(lruvec_memcg(lruvec), item, nr_scanned)
1954  spin_unlock_irq( & Write-intensive fields used by page reclaim )
1956  如果nr_taken恒等于0则返回:0
1959  nr_reclaimed等于shrink_page_list() returns the number of reclaimed pages
1962  spin_lock_irq( & Write-intensive fields used by page reclaim )
1964  item等于如果current_is_kswapd()则PGSTEAL_KSWAPD否则PGSTEAL_DIRECT
1965  如果非cgroup_reclaim(sc)则__count_vm_events(item, nr_reclaimed)
1967  __count_memcg_events(lruvec_memcg(lruvec), item, nr_reclaimed)
1968  * The pageout code in vmscan.c keeps track of how many of the * mem/swap backed and file backed pages are referenced. * The higher the rotated/scanned ratio, the more valuable * that cache is. * The anon LRU stats live in [0], file LRU stats in [1][0]加等于nr_activate[0]
1969  * The pageout code in vmscan.c keeps track of how many of the * mem/swap backed and file backed pages are referenced. * The higher the rotated/scanned ratio, the more valuable * that cache is. * The anon LRU stats live in [0], file LRU stats in [1][1]加等于nr_activate[1]
1971  This moves pages from @list to corresponding LRU list.* We move them the other way if the page is referenced by one or more* processes, from rmap.* If the pages are mostly unmapped, the processing is fast and it is
1973  __mod_node_page_state(pgdat, NR_ISOLATED_ANON + file, - nr_taken)
1975  spin_unlock_irq( & Write-intensive fields used by page reclaim )
1977  mem_cgroup_uncharge_list( & page_list)
1978  free_unref_page_list( & page_list)
1991  如果nr_unqueued_dirty恒等于nr_takenwakeup_flusher_threads(WB_REASON_VMSCAN)
1994  dirty加等于nr_dirty
1995  congested加等于nr_congested
1996  unqueued_dirty加等于nr_unqueued_dirty
1997  writeback加等于nr_writeback
1998  immediate加等于nr_immediate
1999  taken加等于nr_taken
2000  如果filefile_taken加等于nr_taken
2003  trace_mm_vmscan_lru_shrink_inactive(全局结点ID, nr_scanned, nr_reclaimed, & stat, Scan (total_size >> priority) pages at once , file)
2005  返回:nr_reclaimed
调用者
名称描述
shrink_list