Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:mem_cgroup_can_attach

Proto:static int mem_cgroup_can_attach(struct cgroup_taskset *tset)

Type:int

Parameter:

TypeParameterName
struct cgroup_taskset *tset
5605  struct mem_cgroup * memcg = NULL
5610  ret = 0
5613  If cgroup_subsys_on_dfl - fast test on whether a subsys is on default hierarchy*@ss: subsystem in question(memory_cgrp_subsys) Then Return 0
5622  p = NULL
5623  cgroup_taskset_for_each_leader - iterate group leaders in a cgroup_taskset*@leader: the loop cursor*@dst_css: the destination css*@tset: taskset to iterate* Iterate threadgroup leaders of @tset. For single-task migrations, @tset* may not contain any.(leader, css, tset)
5624  WARN_ON_ONCE(p)
5625  p = leader
5626  memcg = mem_cgroup_from_css(css)
5628  If Not p Then Return 0
5636  move_flags = READ_ONCE(* Should we move charges of a task when a task is moved into this * mem_cgroup ? And what type of charges should we move ?)
5637  If Not move_flags Then Return 0
5640  from = mem_cgroup_from_task(p)
5642  VM_BUG_ON(from == memcg)
5644  mm = get_task_mm - acquire a reference to the task's mm* Returns %NULL if the task has no mm. Checks PF_KTHREAD (meaning* this kernel workthread has transiently adopted a user mm with use_mm,* to do its AIO) is not set and if so returns a reference to it, after
5645  If Not mm Then Return 0
5648  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
5649  VM_BUG_ON(from)
5650  VM_BUG_ON(to)
5651  VM_BUG_ON(precharge)
5652  VM_BUG_ON(moved_charge)
5653  VM_BUG_ON(moved_swap)
5655  spin_lock( & r from, to )
5656  mm = mm
5657  from = from
5658  to = memcg
5659  flags = move_flags
5660  spin_unlock( & r from, to )
5663  ret = mem_cgroup_precharge_mc(mm)
5664  If ret Then mem_cgroup_clear_mc()
5666  Else
5667  Decrement the use count and release all resources for an mm.
5669  Return ret