Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\mlock.c Create Date:2022-07-28 14:46:06
Last Modify:2022-05-23 14:12:58 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:user_shm_lock

Proto:int user_shm_lock(size_t size, struct user_struct *user)

Type:int

Parameter:

TypeParameterName
size_tsize
struct user_struct *user
848  allowed = 0
850  locked = size + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
851  lock_limit = rlimit(RLIMIT_MEMLOCK)
852  If lock_limit == RLIM_INFINITY Then allowed = 1
854  lock_limit >>= PAGE_SHIFT determines the page size
855  spin_lock( & Objects with different lifetime than processes (SHM_LOCK and SHM_HUGETLB* shm segments) get accounted against the user_struct instead.)
856  If Not allowed && locked + How many pages of mlocked shm ? > lock_limit && Not Check operation authority Then Go to out
859  get_uid(user)
860  How many pages of mlocked shm ? += locked
861  allowed = 1
862  out :
863  spin_unlock( & Objects with different lifetime than processes (SHM_LOCK and SHM_HUGETLB* shm segments) get accounted against the user_struct instead.)
864  Return allowed