Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:mem_cgroup_protected - check if memory consumption is in the normal range*@root: the top ancestor of the sub-tree being checked*@memcg: the memory cgroup to check* WARNING: This function is not stateless! It can only be used as part

Proto:enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root, struct mem_cgroup *memcg)

Type:enum mem_cgroup_protection

Parameter:

TypeParameterName
struct mem_cgroup *root
struct mem_cgroup *memcg
6250  If mem_cgroup_disabled() Then Return MEMCG_PROT_NONE
6253  If Not root Then root = root_mem_cgroup
6255  If memcg == root Then Return MEMCG_PROT_NONE
6258  usage = page_counter_read( & Accounted resources )
6259  If Not usage Then Return MEMCG_PROT_NONE
6262  emin = min
6263  elow = low
6265  parent = parent_mem_cgroup - find the accounting parent of a memcg*@memcg: memcg whose parent to find* Returns the parent memcg, or NULL if this is the root or the memory* controller is in legacy no-hierarchy mode.
6267  If Not parent Then Return MEMCG_PROT_NONE
6270  If parent == root Then Go to exit
6273  parent_emin = READ_ONCE( effective memory.min and memory.min usage tracking )
6274  emin = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(emin, parent_emin)
6275  If emin && parent_emin Then
6278  min_usage = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(usage, min)
6279  siblings_min_usage = atomic_long_read( & children_min_usage)
6282  If min_usage && siblings_min_usage Then emin = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(emin, parent_emin * min_usage / siblings_min_usage)
6287  parent_elow = READ_ONCE( effective memory.low and memory.low usage tracking )
6288  elow = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(elow, parent_elow)
6289  If elow && parent_elow Then
6292  low_usage = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(usage, low)
6293  siblings_low_usage = atomic_long_read( & children_low_usage)
6296  If low_usage && siblings_low_usage Then elow = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(elow, parent_elow * low_usage / siblings_low_usage)
6301  exit :
6302  effective memory.min and memory.min usage tracking = emin
6303  effective memory.low and memory.low usage tracking = elow
6305  If usage <= emin Then Return MEMCG_PROT_MIN
6307  Else if usage <= elow Then Return MEMCG_PROT_LOW
6309  Else Return MEMCG_PROT_NONE