Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Check whether swap entry is valid in the swap device

Proto:struct swap_info_struct *get_swap_device(swp_entry_t entry)

Type:struct swap_info_struct

Parameter:

TypeParameterName
swp_entry_tentry
1254  If Not val Then Go to out
1256  si = swp_swap_info(entry)
1257  If Not si Then Go to bad_nofile
1260  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1261  If Not (SWP_USED etc: see above & SWP_VALID) Then Go to unlock_out
1263  offset = Extract the `offset' field from a swp_entry_t. The swp_entry_t is in* arch-independent format
1264  If offset >= xtent of the swap_map Then Go to unlock_out
1267  Return si
1268  bad_nofile :
1269  pr_err("%s: %s%08lx\n", __func__, Bad_file, val)
1270  out :
1271  Return NULL
1272  unlock_out :
1273  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1274  Return NULL
Caller
NameDescribe
total_swapcache_pages
lookup_swap_cacheLookup a swap entry in the swap cache. A found page will be returned* unlocked and with its refcount incremented - we rely on the kernel* lock getting page table operations atomic even if we drop the page* lock before returning.
__read_swap_cache_async
__swap_count
__swp_swapcountHow many references to @entry are currently swapped out?* This does not give an exact answer when swap count is continued,* but does include the high COUNT_CONTINUED flag to allow for that.
__swap_duplicateVerify that a swap entry is valid and increment its swap map count.* Returns error code in following case.* - success -> 0* - swp_entry is invalid -> EINVAL* - swp_entry is migration entry -> EINVAL
add_swap_count_continuationadd_swap_count_continuation - called when a swap count is duplicated* beyond SWAP_MAP_MAX, it allocates a new page and links that to the entry's* page of the original vmalloc'ed swap_map, to hold the continuation count