函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:get_swap_pages

函数原型:int get_swap_pages(int n_goal, swp_entry_t swp_entries[], int entry_size)

返回类型:int

参数:

类型参数名称
intn_goal
swp_entry_tswp_entries
intentry_size
994  size等于Define swap_entry_size() as constant to let compiler to optimize* out some code if !CONFIG_THP_SWAP(entry_size)
997  n_ret等于0
1001  WARN_ON_ONCE(n_goal > 1 && size == SWAPFILE_CLUSTER)
1003  avail_pgs等于atomic_long_read( & nr_swap_pages)除size
1004  如果avail_pgs小于等于0则转到:noswap
1007  如果n_goal大于SWAP_BATCHn_goal等于SWAP_BATCH
1010  如果n_goal大于avail_pgsn_goal等于avail_pgs
1013  atomic_long_sub(n_goal * size, & nr_swap_pages)
1015  加自旋锁
1017  start_over :
1018  node等于Returns the number of the current Node.
1019  plist_for_each_entry_safe - iterate safely over list of given type*@pos: the type * to use as a loop counter*@n: another type * to use as temporary storage*@head: the head for your list*@m: the name of the list_head within the struct(si, next, & all available (active, not full) swap_info_structs* protected with swap_avail_lock, ordered by priority.* This is used by get_swap_page() instead of swap_active_head* because swap_active_head includes all swap_info_structs,[node], avail_lists[node])
1021  plist_requeue - Requeue @node at end of same-prio entries
1022  自旋锁解锁
1023  加自旋锁
1025  加自旋锁
1026  如果节点不在链表上
1028  转到:nextsi
1030  WARN(!dex of last free in swap_map , "swap_info %d in list but !highest_bit\n", strange name for an index )
1033  WARN(!(SWP_USED etc: see above & SWP_WRITEOK), "swap_info %d in list but !SWP_WRITEOK\n", strange name for an index )
1038  转到:nextsi
1040  如果size恒等于SWAPFILE_CLUSTER
1041  如果非SWP_USED etc: see above 按位与SWP_FS的值则n_ret等于swap_alloc_cluster(si, swp_entries)
1043  否则n_ret等于scan_swap_map_slots(si, Flag page is cached, in first swap_map , n_goal, swp_entries)
1046  自旋锁解锁
1047  如果n_retsize恒等于SWAPFILE_CLUSTER则转到:check_out
1049  pr_debug("scan_swap_map of si %d failed to find offset\n", strange name for an index )
1052  加自旋锁
1053  nextsi :
1065  如果节点不在链表上则转到:start_over
1069  自旋锁解锁
1071  check_out :
1072  如果n_ret小于n_goalatomic_long_add((long)(n_goal - n_ret) * size, & nr_swap_pages)
1075  noswap :
1076  返回:n_ret
调用者
名称描述
refill_swap_slots_cachealled with swap slot cache's alloc lock held
get_swap_page