Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swap_cgroup.c Create Date:2022-07-28 16:15:53
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:swap_cgroup_swapon

Proto:int swap_cgroup_swapon(int type, unsigned long max_pages)

Type:int

Parameter:

TypeParameterName
inttype
unsigned longmax_pages
174  If Not Whether the swap controller is active Then Return 0
177  length = DIV_ROUND_UP(max_pages, SC_PER_PAGE)
178  array_size = length * size of *
180  array = vzalloc - allocate virtually contiguous memory with zero fill*@size: allocation size* Allocate enough pages to cover @size from the page level* allocator and map them into contiguous kernel virtual space
181  If Not array Then Go to nomem
184  ctrl = swap_cgroup_ctrl[type]
185  mutex_lock( & swap_cgroup_mutex)
186  length = length
187  map = array
188  Process spin lock initialization( & lock)
189  If allocate buffer for swap_cgroup. Then
191  map = NULL
192  length = 0
193  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
194  vfree - release memory allocated by vmalloc()*@addr: memory base address* Free the virtually continuous memory area starting at @addr, as* obtained from vmalloc(), vmalloc_32() or __vmalloc()
195  Go to nomem
197  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
199  Return 0
200  nomem :
201  pr_info("couldn't allocate enough memory for swap_cgroup\n")
202  pr_info("swap_cgroup can be disabled by swapaccount=0 boot option\n")
203  Return -ENOMEM
Caller
NameDescribe
SYSCALL_DEFINE2