函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:shrink_node

函数原型:static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)

返回类型:bool

参数:

类型参数名称
pg_data_t *pgdat
struct scan_control *sc
2703  reclaim_state等于reclaim_state
2706  bool reclaimable = false
2709  target_lruvec等于mem_cgroup_lruvec - get the lru list vector for a memcg & node*@memcg: memcg of the wanted lruvec* Returns the lru list vector holding pages for a given @memcg &*@node combination. This can be the node lruvec, if the memory* controller is disabled.
2711  again :
2712  memset( & nr, 0, nr的长度)
2714  nr_reclaimed等于 Number of pages freed so far during a call to shrink_zones()
2715  nr_scanned等于 Incremented by the number of inactive pages that were scanned
2721  如果非force_deactivate
2724  如果The inactive anon list should be small enough that the VM never has* to do too much work.* The inactive file list should be small enough to leave most memory* to the established workingset on the scan-resistant active list,may_deactivate或等于Can active pages be deactivated as part of reclaim?
2726  否则may_deactivate与等于Can active pages be deactivated as part of reclaim? 的反
2734  refaults等于lruvec_page_state(target_lruvec, WORKINGSET_ACTIVATE)
2736  如果refaults不等于 Refaults at the time of last reclaim cycle The inactive anon list should be small enough that the VM never has* to do too much work.* The inactive file list should be small enough to leave most memory* to the established workingset on the scan-resistant active list,may_deactivate或等于DEACTIVATE_FILE
2739  否则may_deactivate与等于DEACTIVATE_FILE的反
2741  否则may_deactivate等于Can active pages be deactivated as part of reclaim? 按位或DEACTIVATE_FILE
2749  file等于lruvec_page_state(target_lruvec, NR_INACTIVE_FILE)
2750  如果file右移 Scan (total_size >> priority) pages at once 位且非may_deactivate按位与DEACTIVATE_FILE的值则 There is easily reclaimable cold cache in the current node 等于1
2752  否则 There is easily reclaimable cold cache in the current node 等于0
2764  如果非cgroup_reclaim(sc)则
2765  total_high_wmark等于0
2769  free等于sum_zone_node_page_state(全局结点ID, NR_FREE_PAGES)
2770  file等于node_page_state(pgdat, NR_ACTIVE_FILE)加node_page_state(pgdat, NR_INACTIVE_FILE)
2773 z小于MAX_NR_ZONES循环
2786  anon等于node_page_state(pgdat, NR_INACTIVE_ANON)
2788  The file pages on the current node are dangerously low 等于filefree小于等于total_high_wmark且非may_deactivate按位与Can active pages be deactivated as part of reclaim? 的值且anon右移 Scan (total_size >> priority) pages at once
2794  shrink_node_memcgs(pgdat, sc)
2796  如果reclaim_state
2797  Number of pages freed so far during a call to shrink_zones() 加等于reclaimed_slab
2798  reclaimed_slab等于0
2802  vmpressure( This context's GFP mask , * The memory cgroup that hit its limit and as a result is the * primary target of this reclaim invocation., true, Incremented by the number of inactive pages that were scanned - nr_scanned, Number of pages freed so far during a call to shrink_zones() - nr_reclaimed)
2806  如果 Number of pages freed so far during a call to shrink_zones() nr_reclaimedreclaimable = true
2809  如果current_is_kswapd()则
2827  如果writebackwriteback恒等于taken设置内存位
2831  如果unqueued_dirty恒等于file_taken设置内存位
2840  如果immediategestion_wait - wait for a backing_dev to become uncongested*@sync: SYNC or ASYNC IO*@timeout: timeout in jiffies* Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit* write congestion
2852  如果current_is_kswapd()或cgroup_reclaim(sc)且writeback_throttling_sane - is the usual dirty throttling mechanism available?*@sc: scan_control in question* The normal page dirty throttling mechanism in balance_dirty_pages() is* completely broken with the legacy memcg and direct stalling in* 的值且dirtydirty恒等于congested设置内存位
2863  如果非current_is_kswapd()且If a kernel thread (such as nfsd for loop-back mounts) services* a backing device by writing to the page cache it sets PF_LESS_THROTTLE.* In that case we should only throttle if the backing device it is* writing to is congested且非hibernation_modest_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting fromwait_iff_congested - Conditionally wait for a backing_dev to become uncongested or a pgdat to complete writes*@sync: SYNC or ASYNC IO*@timeout: timeout in jiffies* In the event of a congested backing_dev (any backing_dev) this waits* for up to @timeout
2868  如果Reclaim/compaction is used for high-order allocation requests. It reclaims* order-0 pages before compacting the zone. should_continue_reclaim() returns* true if more pages should be reclaimed such that when the page allocator则转到:again
2878  如果reclaimable Number of 'reclaimed == 0' runs 等于0
2881  返回:reclaimable
调用者
名称描述
shrink_zonesThis is the direct reclaim path, for page-allocating processes. We only* try to reclaim pages from zones which will satisfy the caller's allocation* request.* If a zone is deemed to be full of pinned pages then just give it a light
kswapd_shrink_nodekswapd shrinks a node of pages that are at or below the highest usable* zone that is currently unbalanced.* Returns true if kswapd scanned at least the requested number of pages to* reclaim or if the lack of progress was due to pages under writeback.
__node_reclaimTry to free up some pages from this node through reclaim.