mm/memcg: return -EBUSY when oom-kill-disable modified and memcg use_hierarchy, has children
Subsystems (2)
PATCH 1/1 mm/memcg: return -EBUSY when oom-kill-disable modified and memcg use_hierarchy, has children
From: Wanpeng Li <[email protected]>
When oom-kill-disable modified by the user and current memcg use_hierarchy, the change can occur, provided the current memcg has no children. If it has children, return -EBUSY is enough.
--- mm/memcontrol.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
mm/memcontrol.c +5 -2
@@ -4521,11 +4521,14 @@ static int mem_cgroup_oom_control_write(struct cgroup *cgrp,cgroup_lock ();/* oom-kill-disable is a flag for subhierarchy. */ -if ((parent->use_hierarchy) || - (memcg->use_hierarchy && !list_empty (&cgrp->children))) { +if (parent->use_hierarchy) {cgroup_unlock ();return -EINVAL ; + }else if (memcg->use_hierarchy && !list_empty (&cgrp->children)) { +cgroup_unlock (); +return -EBUSY ; } + memcg->oom_kill_disable = val;if (!val)memcg_oom_recover (memcg);
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 7 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
When oom-kill-disable modified by the user and current memcg
use_hierarchy, the change can occur, provided the current memcg has no children. If it has children, return-EBUSYis enough.Signed-off-by Wanpeng Li <[email protected]>
I'm sorry what is the point ? You think -EBUSY should be returned in this case rather than -EINVAl ? Then, why ?
Quoted 16 lines
--- mm/memcontrol.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)mm/memcontrol.c +1
-2@@ -4521,11 +4521,14 @@ static int mem_cgroup_oom_control_write(struct cgroup *cgrp,cgroup_lock ();/* oom-kill-disable is a flag for subhierarchy. */ -if ((parent->use_hierarchy) || - (memcg->use_hierarchy && !list_empty (&cgrp->children))) { +if (parent->use_hierarchy) {
mm/memcontrol.c static int mem_cgroup_oom_control_write(struct cgroup *cgrp, · line 4534
Quoted 10 lines
mm/memcontrol.c +4
-0cgroup_unlock ();return -EINVAL ; + }else if (memcg->use_hierarchy && !list_empty (&cgrp->children)) { +cgroup_unlock (); +return -EBUSY ; } + memcg->oom_kill_disable = val;if (!val)memcg_oom_recover (memcg);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Kamezawa Hiroyuki
Quoted 7 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
When oom-kill-disable modified by the user and current memcg
use_hierarchy, the change can occur, provided the current memcg has no children. If it has children, return-EBUSYis enough.Signed-off-by Wanpeng Li <[email protected]>I'm sorry what is the point ? You think
-EBUSYshould be returned in this case rather than -EINVAl ? Then, why ?
just like in function cmem_cgroup_hierarchy_write:
if((!parent_memcg || !parent_memcg->use_hierarchy) &&
(val == 1 || val == 0) {
if (list_empty(&cont->children))
memcg->use_hierarchy = val;
else
return -EBUSY;
} else
return = -EINVAL;If memcg->use_hierarchy && has children memcg, the user can try again if children memcg disappear. Or I miss something ....
Regards,
Wanpeng Li
Quoted 12 lines
Quoted 12 lines
--- mm/memcontrol.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)mm/memcontrol.c +0
-0@@ -4521,11 +4521,14 @@ static int mem_cgroup_oom_control_write(struct cgroup *cgrp,
Quoted 18 lines
Quoted 6 lines
mm/memcontrol.c +1
-2cgroup_lock ();/* oom-kill-disable is a flag for subhierarchy. */ -if ((parent->use_hierarchy) || - (memcg->use_hierarchy && !list_empty (&cgrp->children))) { +if (parent->use_hierarchy) {mm/memcontrol.c static int mem_cgroup_oom_control_write(struct cgroup *cgrp, · line 4534
Quoted 10 lines
mm/memcontrol.c +4
-0cgroup_unlock ();return -EINVAL ; + }else if (memcg->use_hierarchy && !list_empty (&cgrp->children)) { +cgroup_unlock (); +return -EBUSY ; } + memcg->oom_kill_disable = val;if (!val)memcg_oom_recover (memcg);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
When oom-kill-disable modified by the user and current memcg
use_hierarchy, the change can occur, provided the current memcg has no children. If it has children, return-EBUSYis enough.
I do not think EBUSY makes any difference. I would much rather see the test go away...
Quoted 29 lines
Signed-off-by Wanpeng Li <[email protected]>--- mm/memcontrol.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)mm/memcontrol.c +5
-2@@ -4521,11 +4521,14 @@ static int mem_cgroup_oom_control_write(struct cgroup *cgrp,cgroup_lock ();/* oom-kill-disable is a flag for subhierarchy. */ -if ((parent->use_hierarchy) || - (memcg->use_hierarchy && !list_empty (&cgrp->children))) { +if (parent->use_hierarchy) {cgroup_unlock ();return -EINVAL ; + }else if (memcg->use_hierarchy && !list_empty (&cgrp->children)) { +cgroup_unlock (); +return -EBUSY ; } + memcg->oom_kill_disable = val;if (!val)memcg_oom_recover (memcg);Signature · 1 line
1.7.5.4
Signature · 12 lines
Michal Hocko SUSE Labs SUSE LINUX s.r.o. Lihovarska 1060/12 190 00 Praha 9 Czech Republic -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>