函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Check whether swap entry is valid in the swap device

函数原型:struct swap_info_struct *get_swap_device(swp_entry_t entry)

返回类型:struct swap_info_struct

参数:

类型参数名称
swp_entry_tentry
1254  如果非val则转到:out
1256  si等于swp_swap_info(entry)
1257  如果非si则转到: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  如果非SWP_USED etc: see above 按位与SWP_VALID的值则转到:unlock_out
1263  offset等于Extract the `offset' field from a swp_entry_t. The swp_entry_t is in* arch-independent format
1264  如果offset大于等于xtent of the swap_map 则转到:unlock_out
1267  返回:si
1268  bad_nofile :
1269  打印错误信息("%s: %s%08lx\n", __func__, Bad_file, val)
1270  out :
1271  返回: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  返回:NULL
调用者
名称描述
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