函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:If the boolean frontswap is true, only unuse pages_to_unuse pages;* pages_to_unuse==0 means all pages; ignored if frontswap is false

函数原型:int try_to_unuse(unsigned int type, bool frontswap, unsigned long pages_to_unuse)

返回类型:int

参数:

类型参数名称
unsigned inttype
boolfrontswap
unsigned longpages_to_unuse
2129  retval等于0
2130  si等于swap_info[type]
2135  如果非umber of those currently in use 则返回:0
2138  如果非frontswappages_to_unuse等于0
2141  retry :
2142  retval等于shmem_unuse(type, frontswap, & pages_to_unuse)
2143  如果retval则转到:out
2146  prev_mm等于For dynamically allocated mm_structs, there is a dynamically sized cpumask* at the end of the structure, the size of which depends on the maximum CPU* number the system can see
2147  mmget() - Pin the address space associated with a &struct mm_struct.*@mm: The address space to pin.* Make sure that the address space of the given &struct mm_struct doesn't* go away. This does not protect against parts of the address space being
2149  加自旋锁
2150  p等于 List of maybe swapped mm's. These * are globally strung together off * init_mm.mmlist, and are protected * by mmlist_lock
2151 umber of those currently in use 且非signal_pending(当前进程)且p等于链表后项不等于 List of maybe swapped mm's. These * are globally strung together off * init_mm.mmlist, and are protected * by mmlist_lock循环
2155  mm等于list_entry - get the struct for this entry*@ptr: the &struct list_head pointer.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.(p, structmm_struct, mmlist)
2156  如果非mmget_not_zero(mm)则继续下一循环
2158  自旋锁解锁
2159  Decrement the use count and release all resources for an mm.
2160  prev_mm等于mm
2161  retval等于unuse_mm(mm, type, frontswap, & pages_to_unuse)
2163  如果retval
2165  转到:out
2172  cond_resched()
2173  加自旋锁
2175  自旋锁解锁
2177  Decrement the use count and release all resources for an mm.
2179  i等于0
2180 umber of those currently in use 且非signal_pending(当前进程)且i等于Scan swap_map (or frontswap_map if frontswap parameter is true)* from current position to next entry still in use. Return 0* if there are no inuse entries after prev till end of the map.不等于0循环
2184  entry等于Store a type+offset into a swp_entry_t in an arch-independent format
2185  page等于d_get_page - find and get a page reference*@mapping: the address_space to search*@offset: the page index* Looks up the page cache slot at @mapping & @offset. If there is a* page cache page, it is returned with an increased refcount.
2186  如果非page则继续下一循环
2195  lock_page may only be called if we have the page's inode pinned.
2196  Wait for a page to complete writeback
2197  If swap is getting full, or if there are no more mappings of this page,* then try_to_free_swap is called to free its swap space.
2198  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
2199  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
2206  如果pages_to_unusepages_to_unuse先自减恒等于0则转到:out
2222  如果umber of those currently in use
2223  如果非signal_pending(当前进程)则转到:retry
2225  retval等于负EINTR
2227  out :
2228  返回:如果retval恒等于Return code to denote that requested number of* frontswap pages are unused(moved to page cache).* Used in in shmem_unuse and try_to_unuse.则0否则retval
调用者
名称描述
SYSCALL_DEFINE1
frontswap_shrinkFrontswap, like a true swap device, may unnecessarily retain pages* under certain circumstances; "shrink" frontswap is essentially a* "partial swapoff" and works by calling try_to_unuse to attempt to* unuse enough frontswap pages to attempt to -- subject