Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:ipc\shm.c Create Date:2022-07-28 16:46:39
Last Modify:2020-03-17 22:58:32 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:shm_destroy

Proto:static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)

Type:void

Parameter:

TypeParameterName
struct ipc_namespace *ns
struct shmid_kernel *shp
283  shm_file = shm_file
284  shm_file = NULL
285  shm_tot -= shm_segsz + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
286  shm_rmid(ns, shp)
287  shm_unlock(shp)
288  If Not is_file_hugepages(shm_file) Then shmem_lock(shm_file, 0, mlock_user)
290  Else if mlock_user Then user_shm_unlock(NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they , mlock_user)
293  fput(shm_file)
294  ipc_update_pid( & shm_cprid, NULL)
295  ipc_update_pid( & shm_lprid, NULL)
296  ipc_rcu_putref( & shm_perm, shm_rcu_free)
Caller
NameDescribe
do_shm_rmidCalled with shm_ids.rwsem (writer) and the shp structure locked.* Only shm_ids.rwsem remains locked on exit.
shm_close
shm_try_destroy_orphanedCalled with ns->shm_ids(ns).rwsem locked
exit_shmLocking assumes this will only be called with task == current
do_shmatFix shmaddr, allocate descriptor, map shm, add attach descriptor to lists.* NOTE! Despite the name, this is NOT a direct system call entrypoint. The* "raddr" thing points to kernel space, and there has to be a wrapper around* this.