函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swapfile.c Create Date:2022-07-27 16:46:59
Last Modify:2020-03-17 22:19:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Doing discard actually. After a cluster discard is finished, the cluster* will be added to free cluster list. caller should hold si->lock.

函数原型:static void swap_do_scheduled_discard(struct swap_info_struct *si)

返回类型:void

参数:

类型参数名称
struct swap_info_struct *si
474  info等于cluster info. Only for SSD
476  当非cluster_list_empty( & discard clusters list )循环
477  idx等于cluster_list_del_first( & discard clusters list , info)
478  自旋锁解锁
480  swap allocation tell device that a cluster of swap can now be discarded,* to allow the swap device to optimize its wear-levelling.
483  加自旋锁
484  ci等于lock_cluster(si, idx * SWAPFILE_CLUSTER)
485  __free_cluster(si, idx)
486  memset(vmalloc'ed array of usage counts + idx * SWAPFILE_CLUSTER, 0, SWAPFILE_CLUSTER)
488  unlock_cluster(ci)
调用者
名称描述
swap_discard_work
scan_swap_map_try_ssd_clusterTry to get a swap entry from current cpu's swap entry pool (a cluster). This* might involve allocating a new cluster for current CPU too.