Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swapfile.c Create Date:2022-07-28 15:16:47
Last Modify:2020-03-17 22:19:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Try 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.

Proto:static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, unsigned long *offset, unsigned long *scan_base)

Type:bool

Parameter:

TypeParameterName
struct swap_info_struct *si
unsigned long *offset
unsigned long *scan_base
607  new_cluster :
608  cluster = this_cpu_ptr(per cpu's swap location )
609  If cluster_is_null( & Current cluster index ) Then
610  If Not cluster_list_empty( & clusters list ) Then
614  Else if Not cluster_list_empty( & discard clusters list ) Then
621  Go to new_cluster
622  Else Return false
626  found_free = false
632  tmp = Likely next allocation offset
633  max = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedlong, xtent of the swap_map , (cluster_next( & Current cluster index ) + 1) * SWAPFILE_CLUSTER)
635  If tmp >= max Then
636  cluster_set_null( & Current cluster index )
637  Go to new_cluster
639  ci = lock_cluster(si, tmp)
640  When tmp < max cycle
642  found_free = true
643  Break
645  tmp++
647  unlock_cluster(ci)
648  If Not found_free Then
649  cluster_set_null( & Current cluster index )
650  Go to new_cluster
652  Likely next allocation offset = tmp + 1
653  offset = tmp
654  scan_base = tmp
655  Return found_free
Caller
NameDescribe
scan_swap_map_slots