Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\exit.c Create Date:2022-07-28 09:03:05
Last Modify:2020-03-17 11:17:32 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:A task is exiting. If it owned this mm, find a new owner for the mm.

Proto:void mm_update_next_owner(struct mm_struct *mm)

Type:void

Parameter:

TypeParameterName
struct mm_struct *mm
349  p = current process
351  retry :
356  If * "owner" points to a task that is regarded as the canonical * user/owner of this mm. All of the following must be true in * order for it to be changed: * current == mm->owner * current->mm != mm * new_owner->mm == mm * new_owner->alloc_lock is held != p Then Return
363  If atomic_read( & *@mm_users: The number of users including userspace. * Use mmget()/mmget_not_zero()/mmput() to modify. When this * drops to 0 (i.e. when the task exits and there are no other * temporary reference holders), we also release a reference on *@mm_count (which ) <= 1 Then
364  WRITE_ONCE(* "owner" points to a task that is regarded as the canonical * user/owner of this mm. All of the following must be true in * order for it to be changed: * current == mm->owner * current->mm != mm * new_owner->mm == mm * new_owner->alloc_lock is held, NULL)
365  Return
368  read_lock( & tasklist_lock)
373  If mm == mm Then Go to assign_new_owner
381  If mm == mm Then Go to assign_new_owner
389  If Per task flags (PF_*), defined further below: & I am a kernel thread Then Continue
391  for_each_thread(g, c)
392  If mm == mm Then Go to assign_new_owner
394  If mm Then Break
398  read_unlock( & tasklist_lock)
404  WRITE_ONCE(* "owner" points to a task that is regarded as the canonical * user/owner of this mm. All of the following must be true in * order for it to be changed: * current == mm->owner * current->mm != mm * new_owner->mm == mm * new_owner->alloc_lock is held, NULL)
405  Return
407  assign_new_owner :
408  BUG_ON(c == p)
409  get_task_struct(c)
414  Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring* subscriptions and synchronises with wait4(). Also used in procfs. Also* pins the final release of task.io_context. Also protects ->cpuset and* ->cgroup.subsys[]. And ->vfork_done.
419  read_unlock( & tasklist_lock)
420  If mm != mm Then
421  task_unlock(c)
422  put_task_struct(c)
423  Go to retry
425  WRITE_ONCE(* "owner" points to a task that is regarded as the canonical * user/owner of this mm. All of the following must be true in * order for it to be changed: * current == mm->owner * current->mm != mm * new_owner->mm == mm * new_owner->alloc_lock is held, c)
426  task_unlock(c)
427  put_task_struct(c)
Caller
NameDescribe
exit_mmTurn us into a lazy TLB process if we* aren't already..