[PATCH] cgroup, docs: add a note about returning EBUSY in some cases

2018-05-22 Thread Roman Gushchin
-by: Roman Gushchin <g...@fb.com> Cc: Tejun Heo <t...@kernel.org> Cc: kernel-t...@fb.com Cc: cgro...@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-ker...@vger.kernel.org --- Documentation/cgroup-v2.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/cgr

[PATCH v3 4/4] mm/docs: describe memory.low refinements

2018-04-05 Thread Roman Gushchin
Refine cgroup v2 docs after latest memory.low changes. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@

Re: [patch -mm 0/4] mm, memcg: introduce oom policies

2018-01-17 Thread Roman Gushchin
On Tue, Jan 16, 2018 at 06:14:58PM -0800, David Rientjes wrote: > There are three significant concerns about the cgroup aware oom killer as > it is implemented in -mm: > > (1) allows users to evade the oom killer by creating subcontainers or > using other controllers since scoring is done

Re: [PATCH v13 0/7] cgroup-aware OOM killer

2018-01-11 Thread Roman Gushchin
On Thu, Jan 11, 2018 at 10:08:09AM +0100, Michal Hocko wrote: > On Wed 10-01-18 11:33:45, Andrew Morton wrote: > > On Wed, 10 Jan 2018 05:11:44 -0800 Roman Gushchin <g...@fb.com> wrote: > > > > > The per-process oom_score_adj interface is not the nicest one,

Re: [PATCH v13 0/7] cgroup-aware OOM killer

2018-01-10 Thread Roman Gushchin
Hello, David! On Tue, Jan 09, 2018 at 04:57:53PM -0800, David Rientjes wrote: > On Thu, 30 Nov 2017, Andrew Morton wrote: > > > > This patchset makes the OOM killer cgroup-aware. > > > > Thanks, I'll grab these. > > > > There has been controversy over this patchset, to say the least. I > >

Re: [PATCH v13 3/7] mm, oom: cgroup-aware OOM killer

2017-12-07 Thread Roman Gushchin
it's score is > compared with other leaf memory cgroups. Due to memcg statistics > implementation a special approximation is used for estimating oom_score of > root memory cgroup: we sum oom_score of the belonging processes (or, to be > more precise, tasks owning their mm structures).

Re: [PATCH v13 6/7] mm, oom, docs: describe the cgroup-aware OOM killer

2017-12-01 Thread Roman Gushchin
On Fri, Dec 01, 2017 at 09:41:54AM +0100, Michal Hocko wrote: > On Thu 30-11-17 15:28:23, Roman Gushchin wrote: > > @@ -1229,6 +1252,41 @@ to be accessed repeatedly by other cgroups, it may > > make sense to use > > POSIX_FADV_DONTNEED to relinquish the ownership of memory

Re: [PATCH v13 5/7] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-12-01 Thread Roman Gushchin
On Fri, Dec 01, 2017 at 02:31:45PM +0100, Michal Hocko wrote: > On Fri 01-12-17 13:15:38, Roman Gushchin wrote: > [...] > > So, maybe we just need to return -EAGAIN (or may be -ENOTSUP) on any > > read/write > > attempt if option is not enabled? > > Yes, that woul

Re: [PATCH] mm, oom: simplify alloc_pages_before_oomkill handling

2017-12-01 Thread Roman Gushchin
Hi, Michal! I totally agree that out_of_memory() function deserves some refactoring. But I think there is an issue with your patch (see below): On Fri, Dec 01, 2017 at 10:14:25AM +0100, Michal Hocko wrote: > Recently added alloc_pages_before_oomkill gained new caller with this > patchset and I

Re: [PATCH v13 5/7] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-12-01 Thread Roman Gushchin
On Fri, Dec 01, 2017 at 09:41:13AM +0100, Michal Hocko wrote: > On Thu 30-11-17 15:28:22, Roman Gushchin wrote: > > Add a "groupoom" cgroup v2 mount option to enable the cgroup-aware > > OOM killer. If not set, the OOM selection is performed in > >

[PATCH v13 4/7] mm, oom: introduce memory.oom_group

2017-11-30 Thread Roman Gushchin
established way to protect a particular process from seeing an unexpected SIGKILL from the OOM killer. Ignoring this user defined configuration might lead to data corruptions or other misbehavior. The default value is 0. Signed-off-by: Roman Gushchin <g...@fb.com> Acked-by: Michal Hocko <mho...

[PATCH v13 6/7] mm, oom, docs: describe the cgroup-aware OOM killer

2017-11-30 Thread Roman Gushchin
Document the cgroup-aware OOM killer. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Michal Hocko <mho...@suse.com> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp>

[PATCH v13 7/7] cgroup: list groupoom in cgroup features

2017-11-30 Thread Roman Gushchin
List groupoom in cgroup features list (exported via /sys/kernel/cgroup/features), which can be used by a userspace apps (most likely, systemd) to get an idea which cgroup features are supported by kernel. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Tejun Heo <t...@kernel.org> Cc:

[PATCH v13 5/7] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-11-30 Thread Roman Gushchin
Add a "groupoom" cgroup v2 mount option to enable the cgroup-aware OOM killer. If not set, the OOM selection is performed in a "traditional" per-process way. The behavior can be changed dynamically by remounting the cgroupfs. Signed-off-by: Roman Gushchin <g...@fb.com

[PATCH v13 2/7] mm: implement mem_cgroup_scan_tasks() for the root memory cgroup

2017-11-30 Thread Roman Gushchin
cgroup are iterated over. This patch doesn't introduce any functional change as mem_cgroup_scan_tasks() is never called for the root memcg. This is preparatory work for the cgroup-aware OOM killer, which will use this function to iterate over tasks belonging to the root memcg. Signed-off-by: Roman

[PATCH v13 0/7] cgroup-aware OOM killer

2017-11-30 Thread Roman Gushchin
doc@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: cgro...@vger.kernel.org Cc: linux...@kvack.org Roman Gushchin (7): mm, oom: refactor the oom_kill_process() function mm: implement mem_cgroup_scan_tasks() for the root memory cgroup mm, oom: cgroup-aware OOM killer mm, oom: intro

[PATCH v13 1/7] mm, oom: refactor the oom_kill_process() function

2017-11-30 Thread Roman Gushchin
selection (considering task's children), so we can't use the existing oom_kill_process(). Signed-off-by: Roman Gushchin <g...@fb.com> Acked-by: Michal Hocko <mho...@suse.com> Acked-by: Johannes Weiner <han...@cmpxchg.org> Acked-by: David Rientjes <rient...@google.com> Cc: Vl

Re: [RESEND v12 0/6] cgroup-aware OOM killer

2017-10-27 Thread Roman Gushchin
On Thu, Oct 26, 2017 at 02:03:41PM -0700, David Rientjes wrote: > On Thu, 26 Oct 2017, Johannes Weiner wrote: > > > > The nack is for three reasons: > > > > > > (1) unfair comparison of root mem cgroup usage to bias against that mem > > > cgroup from oom kill in system oom conditions, > >

[RESEND v12 4/6] mm, oom: introduce memory.oom_group

2017-10-19 Thread Roman Gushchin
established way to protect a particular process from seeing an unexpected SIGKILL from the OOM killer. Ignoring this user defined configuration might lead to data corruptions or other misbehavior. The default value is 0. Signed-off-by: Roman Gushchin <g...@fb.com> Acked-by: Michal Hocko <mho...

[RESEND v12 3/6] mm, oom: cgroup-aware OOM killer

2017-10-19 Thread Roman Gushchin
-by: Roman Gushchin <g...@fb.com> Acked-by: Michal Hocko <mho...@suse.com> Acked-by: Johannes Weiner <han...@cmpxchg.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> Cc: David Rientjes <rient...@google.c

[RESEND v12 1/6] mm, oom: refactor the oom_kill_process() function

2017-10-19 Thread Roman Gushchin
selection (considering task's children), so we can't use the existing oom_kill_process(). Signed-off-by: Roman Gushchin <g...@fb.com> Acked-by: Michal Hocko <mho...@suse.com> Acked-by: Johannes Weiner <han...@cmpxchg.org> Acked-by: David Rientjes <rient...@google.com> Cc: Vl

[RESEND v12 2/6] mm: implement mem_cgroup_scan_tasks() for the root memory cgroup

2017-10-19 Thread Roman Gushchin
cgroup are iterated over. This patch doesn't introduce any functional change as mem_cgroup_scan_tasks() is never called for the root memcg. This is preparatory work for the cgroup-aware OOM killer, which will use this function to iterate over tasks belonging to the root memcg. Signed-off-by: Roman

[RESEND v12 0/6] cgroup-aware OOM killer

2017-10-19 Thread Roman Gushchin
on <a...@linux-foundation.org> Cc: Tejun Heo <t...@kernel.org> Cc: kernel-t...@fb.com Cc: cgro...@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux...@kvack.org Roman Gushchin (6): mm, oom: refactor the oom_kill_process() function mm: implemen

[RESEND v12 6/6] mm, oom, docs: describe the cgroup-aware OOM killer

2017-10-19 Thread Roman Gushchin
Document the cgroup-aware OOM killer. Signed-off-by: Roman Gushchin <g...@fb.com> Acked-by: Johannes Weiner <han...@cmpxchg.org> Cc: Michal Hocko <mho...@suse.com> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp>

[RESEND v12 5/6] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-10-19 Thread Roman Gushchin
Add a "groupoom" cgroup v2 mount option to enable the cgroup-aware OOM killer. If not set, the OOM selection is performed in a "traditional" per-process way. The behavior can be changed dynamically by remounting the cgroupfs. Signed-off-by: Roman Gushchin <g...@fb.com

Re: [v11 3/6] mm, oom: cgroup-aware OOM killer

2017-10-13 Thread Roman Gushchin
On Thu, Oct 12, 2017 at 02:50:38PM -0700, David Rientjes wrote: > On Wed, 11 Oct 2017, Roman Gushchin wrote: > > Think about it in a different way: we currently compare per-process usage > and userspace has /proc/pid/oom_score_adj to adjust that usage depending > on priorities

Re: [v11 3/6] mm, oom: cgroup-aware OOM killer

2017-10-11 Thread Roman Gushchin
On Wed, Oct 11, 2017 at 01:21:47PM -0700, David Rientjes wrote: > On Tue, 10 Oct 2017, Roman Gushchin wrote: > > > > We don't need a better approximation, we need a fair comparison. The > > > heuristic that this patchset is implementing is based on the usage of >

Re: [v11 3/6] mm, oom: cgroup-aware OOM killer

2017-10-11 Thread Roman Gushchin
On Tue, Oct 10, 2017 at 02:13:00PM -0700, David Rientjes wrote: > On Tue, 10 Oct 2017, Roman Gushchin wrote: > > > > This seems to unfairly bias the root mem cgroup depending on process > > > size. > > > It isn't treated fairly as a leaf mem cgroup if the

Re: [v11 3/6] mm, oom: cgroup-aware OOM killer

2017-10-10 Thread Roman Gushchin
On Tue, Oct 10, 2017 at 02:13:00PM -0700, David Rientjes wrote: > On Tue, 10 Oct 2017, Roman Gushchin wrote: > > > > This seems to unfairly bias the root mem cgroup depending on process > > > size. > > > It isn't treated fairly as a leaf mem cgroup if the

Re: [v11 3/6] mm, oom: cgroup-aware OOM killer

2017-10-10 Thread Roman Gushchin
On Mon, Oct 09, 2017 at 02:52:53PM -0700, David Rientjes wrote: > On Thu, 5 Oct 2017, Roman Gushchin wrote: > > > Traditionally, the OOM killer is operating on a process level. > > Under oom conditions, it finds a process with the highest oom score > > and kills it. > &

Re: [v10 5/6] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-10-05 Thread Roman Gushchin
On Thu, Oct 05, 2017 at 03:14:19PM +0200, Michal Hocko wrote: > On Wed 04-10-17 16:04:53, Johannes Weiner wrote: > [...] > > That will silently ignore what the user writes to the memory.oom_group > > control files across the system's cgroup tree. > > > > We'll have a knob that lets the workload

[v11 0/6] cgroup-aware OOM killer

2017-10-05 Thread Roman Gushchin
e.jp> Cc: David Rientjes <rient...@google.com> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Tejun Heo <t...@kernel.org> Cc: kernel-t...@fb.com Cc: cgro...@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux...@kvack.org Roman Gu

[v11 2/6] mm: implement mem_cgroup_scan_tasks() for the root memory cgroup

2017-10-05 Thread Roman Gushchin
cgroup are iterated over. This patch doesn't introduce any functional change as mem_cgroup_scan_tasks() is never called for the root memcg. This is preparatory work for the cgroup-aware OOM killer, which will use this function to iterate over tasks belonging to the root memcg. Signed-off-by: Roman

[v11 5/6] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-10-05 Thread Roman Gushchin
Add a "groupoom" cgroup v2 mount option to enable the cgroup-aware OOM killer. If not set, the OOM selection is performed in a "traditional" per-process way. The behavior can be changed dynamically by remounting the cgroupfs. Signed-off-by: Roman Gushchin <g...@fb.com

[v11 3/6] mm, oom: cgroup-aware OOM killer

2017-10-05 Thread Roman Gushchin
is used for estimating it's oom_score: we define it as maximum oom_score of the belonging tasks. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Tetsuo

[v11 4/6] mm, oom: introduce memory.oom_group

2017-10-05 Thread Roman Gushchin
established way to protect a particular process from seeing an unexpected SIGKILL from the OOM killer. Ignoring this user defined configuration might lead to data corruptions or other misbehavior. The default value is 0. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kerne

[v11 1/6] mm, oom: refactor the oom_kill_process() function

2017-10-05 Thread Roman Gushchin
selection (considering task's children), so we can't use the existing oom_kill_process(). Signed-off-by: Roman Gushchin <g...@fb.com> Acked-by: Michal Hocko <mho...@kernel.org> Acked-by: David Rientjes <rient...@google.com> Cc: Vladimir Davydov <vdavydov@gmail.com>

Re: [v10 4/6] mm, oom: introduce memory.oom_group

2017-10-05 Thread Roman Gushchin
On Thu, Oct 05, 2017 at 02:06:49PM +0200, Michal Hocko wrote: > On Wed 04-10-17 16:46:36, Roman Gushchin wrote: > > The cgroup-aware OOM killer treats leaf memory cgroups as memory > > consumption entities and performs the victim selection by comparing > > them based on t

Re: [v10 3/6] mm, oom: cgroup-aware OOM killer

2017-10-05 Thread Roman Gushchin
On Thu, Oct 05, 2017 at 01:12:30PM +0200, Michal Hocko wrote: > On Thu 05-10-17 11:27:07, Roman Gushchin wrote: > > On Wed, Oct 04, 2017 at 02:24:26PM -0700, Shakeel Butt wrote: > [...] > > > Sorry about the confusion. There are two things. First, should we do a > > >

Re: [v10 3/6] mm, oom: cgroup-aware OOM killer

2017-10-05 Thread Roman Gushchin
On Thu, Oct 05, 2017 at 01:40:09AM -0700, David Rientjes wrote: > On Wed, 4 Oct 2017, Johannes Weiner wrote: > > > > By only considering leaf memcgs, does this penalize users if their memcg > > > becomes oc->chosen_memcg purely because it has aggregated all of its > > > processes to be members

Re: [v10 3/6] mm, oom: cgroup-aware OOM killer

2017-10-05 Thread Roman Gushchin
On Wed, Oct 04, 2017 at 02:24:26PM -0700, Shakeel Butt wrote: > >> > + if (memcg_has_children(iter)) > >> > + continue; > >> > >> && iter != root_mem_cgroup ? > > > > Oh, sure. I had a stupid bug in my test script, which prevented me from > > catching this.

Re: [v10 3/6] mm, oom: cgroup-aware OOM killer

2017-10-04 Thread Roman Gushchin
On Wed, Oct 04, 2017 at 01:17:14PM -0700, David Rientjes wrote: > On Wed, 4 Oct 2017, Roman Gushchin wrote: > > > > > @@ -828,6 +828,12 @@ static void __oom_kill_process(struct task_struct > > > > *victim) > > > > struct mm_struct *mm

Re: [v10 3/6] mm, oom: cgroup-aware OOM killer

2017-10-04 Thread Roman Gushchin
On Wed, Oct 04, 2017 at 12:48:03PM -0700, Shakeel Butt wrote: > > + > > +static void select_victim_memcg(struct mem_cgroup *root, struct > > oom_control *oc) > > +{ > > + struct mem_cgroup *iter; > > + > > + oc->chosen_memcg = NULL; > > + oc->chosen_points = 0; > > + > > +

Re: [v10 3/6] mm, oom: cgroup-aware OOM killer

2017-10-04 Thread Roman Gushchin
On Wed, Oct 04, 2017 at 03:27:20PM -0400, Johannes Weiner wrote: > On Wed, Oct 04, 2017 at 04:46:35PM +0100, Roman Gushchin wrote: > > Traditionally, the OOM killer is operating on a process level. > > Under oom conditions, it finds a process with the highest oom scor

[v10 3/6] mm, oom: cgroup-aware OOM killer

2017-10-04 Thread Roman Gushchin
is used for estimating it's oom_score: we define it as maximum oom_score of the belonging tasks. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Tetsuo

[v10 0/6] cgroup-aware OOM killer

2017-10-04 Thread Roman Gushchin
Rientjes <rient...@google.com> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Tejun Heo <t...@kernel.org> Cc: kernel-t...@fb.com Cc: cgro...@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux...@kvack.org Roman Gushchin (6): mm, oom: refa

[v10 5/6] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-10-04 Thread Roman Gushchin
Add a "groupoom" cgroup v2 mount option to enable the cgroup-aware OOM killer. If not set, the OOM selection is performed in a "traditional" per-process way. The behavior can be changed dynamically by remounting the cgroupfs. Signed-off-by: Roman Gushchin <g...@fb.com

[v10 1/6] mm, oom: refactor the oom_kill_process() function

2017-10-04 Thread Roman Gushchin
selection (considering task's children), so we can't use the existing oom_kill_process(). Signed-off-by: Roman Gushchin <g...@fb.com> Acked-by: Michal Hocko <mho...@kernel.org> Acked-by: David Rientjes <rient...@google.com> Cc: Vladimir Davydov <vdavydov@gmail.com>

Re: [v9 3/5] mm, oom: cgroup-aware OOM killer

2017-10-04 Thread Roman Gushchin
On Tue, Oct 03, 2017 at 04:22:46PM +0200, Michal Hocko wrote: > On Tue 03-10-17 15:08:41, Roman Gushchin wrote: > > On Tue, Oct 03, 2017 at 03:36:23PM +0200, Michal Hocko wrote: > [...] > > > I guess we want to inherit the value on the memcg creation but I agree > > >

Re: [v9 3/5] mm, oom: cgroup-aware OOM killer

2017-10-03 Thread Roman Gushchin
On Tue, Oct 03, 2017 at 04:22:46PM +0200, Michal Hocko wrote: > On Tue 03-10-17 15:08:41, Roman Gushchin wrote: > > On Tue, Oct 03, 2017 at 03:36:23PM +0200, Michal Hocko wrote: > [...] > > > I guess we want to inherit the value on the memcg creation but I agree > > >

Re: [v9 3/5] mm, oom: cgroup-aware OOM killer

2017-10-03 Thread Roman Gushchin
On Tue, Oct 03, 2017 at 03:36:23PM +0200, Michal Hocko wrote: > On Tue 03-10-17 13:37:21, Roman Gushchin wrote: > > On Tue, Oct 03, 2017 at 01:48:48PM +0200, Michal Hocko wrote: > [...] > > > Wrt. to the implicit inheritance you brought up in a separate email > >

Re: [v9 2/5] mm: implement mem_cgroup_scan_tasks() for the root memory cgroup

2017-10-03 Thread Roman Gushchin
On Tue, Oct 03, 2017 at 12:49:39PM +0200, Michal Hocko wrote: > On Wed 27-09-17 14:09:33, Roman Gushchin wrote: > > Implement mem_cgroup_scan_tasks() functionality for the root > > memory cgroup to use this function for looking for a OOM victim > > task in the root memory cgro

Re: [v9 4/5] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-10-03 Thread Roman Gushchin
On Tue, Oct 03, 2017 at 01:50:36PM +0200, Michal Hocko wrote: > On Wed 27-09-17 14:09:35, Roman Gushchin wrote: > > Add a "groupoom" cgroup v2 mount option to enable the cgroup-aware > > OOM killer. If not set, the OOM selection is performed in > >

Re: [v9 3/5] mm, oom: cgroup-aware OOM killer

2017-10-03 Thread Roman Gushchin
On Tue, Oct 03, 2017 at 01:48:48PM +0200, Michal Hocko wrote: > On Wed 27-09-17 14:09:34, Roman Gushchin wrote: > > Traditionally, the OOM killer is operating on a process level. > > Under oom conditions, it finds a process with the highest oom score > > and kills it. &

Re: [v8 0/4] cgroup-aware OOM killer

2017-10-02 Thread Roman Gushchin
On Mon, Oct 02, 2017 at 02:24:34PM +0200, Michal Hocko wrote: > On Sun 01-10-17 16:29:48, Shakeel Butt wrote: > > > > > > Going back to Michal's example, say the user configured the following: > > > > > >root > > > /\ > > > A D > > > / \ > > >B C > > > > > > A

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-27 Thread Roman Gushchin
On Wed, Sep 27, 2017 at 08:35:50AM -0700, Tim Hockin wrote: > On Wed, Sep 27, 2017 at 12:43 AM, Michal Hocko wrote: > > On Tue 26-09-17 20:37:37, Tim Hockin wrote: > > [...] > >> I feel like David has offered examples here, and many of us at Google > >> have offered examples as

[v9 0/5] cgroup-aware OOM killer

2017-09-27 Thread Roman Gushchin
...@fb.com Cc: cgro...@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux...@kvack.org Roman Gushchin (5): mm, oom: refactor the oom_kill_process() function mm: implement mem_cgroup_scan_tasks() for the root memory cgroup mm, oom: cgroup-aware OOM killer mm, oom: ad

[v9 1/5] mm, oom: refactor the oom_kill_process() function

2017-09-27 Thread Roman Gushchin
selection (considering task's children), so we can't use the existing oom_kill_process(). Signed-off-by: Roman Gushchin <g...@fb.com> Acked-by: Michal Hocko <mho...@kernel.org> Acked-by: David Rientjes <rient...@google.com> Cc: Vladimir Davydov <vdavydov@gmail.com>

[v9 3/5] mm, oom: cgroup-aware OOM killer

2017-09-27 Thread Roman Gushchin
oom_score of the belonging tasks. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> Cc: David Rie

[v9 4/5] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-09-27 Thread Roman Gushchin
Add a "groupoom" cgroup v2 mount option to enable the cgroup-aware OOM killer. If not set, the OOM selection is performed in a "traditional" per-process way. The behavior can be changed dynamically by remounting the cgroupfs. Signed-off-by: Roman Gushchin <g...@fb.com

[v9 5/5] mm, oom, docs: describe the cgroup-aware OOM killer

2017-09-27 Thread Roman Gushchin
Document the cgroup-aware OOM killer. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp>

[v9 2/5] mm: implement mem_cgroup_scan_tasks() for the root memory cgroup

2017-09-27 Thread Roman Gushchin
to the root cgroup should be iterated over. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> Cc: David

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-27 Thread Roman Gushchin
On Wed, Sep 27, 2017 at 09:43:19AM +0200, Michal Hocko wrote: > On Tue 26-09-17 20:37:37, Tim Hockin wrote: > [...] > > I feel like David has offered examples here, and many of us at Google > > have offered examples as long ago as 2013 (if I recall) of cases where > > the proposed heuristic is

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-27 Thread Roman Gushchin
On Wed, Sep 27, 2017 at 09:37:44AM +0200, Michal Hocko wrote: > On Tue 26-09-17 14:04:41, David Rientjes wrote: > > On Tue, 26 Sep 2017, Michal Hocko wrote: > > > > > > No, I agree that we shouldn't compare sibling memory cgroups based on > > > > different criteria depending on whether group_oom

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-26 Thread Roman Gushchin
On Tue, Sep 26, 2017 at 01:21:34PM +0200, Michal Hocko wrote: > On Tue 26-09-17 11:59:25, Roman Gushchin wrote: > > On Mon, Sep 25, 2017 at 10:25:21PM +0200, Michal Hocko wrote: > > > On Mon 25-09-17 19:15:33, Roman Gushchin wrote: > > > [...] > > > > I

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-26 Thread Roman Gushchin
On Mon, Sep 25, 2017 at 10:25:21PM +0200, Michal Hocko wrote: > On Mon 25-09-17 19:15:33, Roman Gushchin wrote: > [...] > > I'm not against this model, as I've said before. It feels logical, > > and will work fine in most cases. > > > > In this case we can drop a

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-20 Thread Roman Gushchin
On Tue, Sep 19, 2017 at 01:54:48PM -0700, David Rientjes wrote: > On Fri, 15 Sep 2017, Roman Gushchin wrote: > > > > > > But then you just enforce a structural restriction on your > > > > > configuration > > > > > because > > > &

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-20 Thread Roman Gushchin
On Mon, Sep 18, 2017 at 08:14:05AM +0200, Michal Hocko wrote: > On Fri 15-09-17 08:23:01, Roman Gushchin wrote: > > On Fri, Sep 15, 2017 at 12:58:26PM +0200, Michal Hocko wrote: > > > On Thu 14-09-17 09:05:48, Roman Gushchin wrote: > > > > On Thu, Sep 14, 2017 at

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-18 Thread Roman Gushchin
On Mon, Sep 18, 2017 at 08:20:45AM +0200, Michal Hocko wrote: > On Fri 15-09-17 14:08:07, Roman Gushchin wrote: > > On Fri, Sep 15, 2017 at 12:55:55PM -0700, David Rientjes wrote: > > > On Fri, 15 Sep 2017, Roman Gushchin wrote: > > > > > > > > But then

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-15 Thread Roman Gushchin
On Fri, Sep 15, 2017 at 12:55:55PM -0700, David Rientjes wrote: > On Fri, 15 Sep 2017, Roman Gushchin wrote: > > > > But then you just enforce a structural restriction on your configuration > > > because > > > root > > > / \ > > &

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-15 Thread Roman Gushchin
On Fri, Sep 15, 2017 at 12:58:26PM +0200, Michal Hocko wrote: > On Thu 14-09-17 09:05:48, Roman Gushchin wrote: > > On Thu, Sep 14, 2017 at 03:40:14PM +0200, Michal Hocko wrote: > > > On Wed 13-09-17 14:56:07, Roman Gushchin wrote: > > > > On Wed, Sep 13, 2017 at

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-14 Thread Roman Gushchin
On Thu, Sep 14, 2017 at 03:40:14PM +0200, Michal Hocko wrote: > On Wed 13-09-17 14:56:07, Roman Gushchin wrote: > > On Wed, Sep 13, 2017 at 02:29:14PM +0200, Michal Hocko wrote: > [...] > > > I strongly believe that comparing only leaf memcgs > > > is more strai

Re: [v8 0/4] cgroup-aware OOM killer

2017-09-13 Thread Roman Gushchin
On Wed, Sep 13, 2017 at 02:29:14PM +0200, Michal Hocko wrote: > On Mon 11-09-17 13:44:39, David Rientjes wrote: > > On Mon, 11 Sep 2017, Roman Gushchin wrote: > > > > > This patchset makes the OOM killer cgroup-aware. > > > > > > v8: > >

Re: [v8 3/4] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-09-12 Thread Roman Gushchin
On Mon, Sep 11, 2017 at 01:48:39PM -0700, David Rientjes wrote: > On Mon, 11 Sep 2017, Roman Gushchin wrote: > > > Add a "groupoom" cgroup v2 mount option to enable the cgroup-aware > > OOM killer. If not set, the OOM selection is performed in > &g

[v8 2/4] mm, oom: cgroup-aware OOM killer

2017-09-11 Thread Roman Gushchin
. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> Cc: David Rientjes <rient...@google.c

[v8 3/4] mm, oom: add cgroup v2 mount option for cgroup-aware OOM killer

2017-09-11 Thread Roman Gushchin
Add a "groupoom" cgroup v2 mount option to enable the cgroup-aware OOM killer. If not set, the OOM selection is performed in a "traditional" per-process way. The behavior can be changed dynamically by remounting the cgroupfs. Signed-off-by: Roman Gushchin <g...@fb.com

[v8 4/4] mm, oom, docs: describe the cgroup-aware OOM killer

2017-09-11 Thread Roman Gushchin
Document the cgroup-aware OOM killer. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp>

[v8 0/4] cgroup-aware OOM killer

2017-09-11 Thread Roman Gushchin
a...@linux-foundation.org> Cc: Tejun Heo <t...@kernel.org> Cc: kernel-t...@fb.com Cc: cgro...@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux...@kvack.org Roman Gushchin (4): mm, oom: refactor the oom_kill_process() function mm, oom: cgroup-aw

Re: [v7 5/5] mm, oom: cgroup v2 mount option to disable cgroup-aware OOM killer

2017-09-11 Thread Roman Gushchin
On Mon, Sep 11, 2017 at 11:05:59AM +0200, Michal Hocko wrote: > On Thu 07-09-17 12:14:57, Johannes Weiner wrote: > > On Wed, Sep 06, 2017 at 10:28:59AM +0200, Michal Hocko wrote: > > > On Tue 05-09-17 17:53:44, Johannes Weiner wrote: > > > > The cgroup-awareness in the OOM killer is exactly the

Re: [v7 5/5] mm, oom: cgroup v2 mount option to disable cgroup-aware OOM killer

2017-09-07 Thread Roman Gushchin
On Thu, Sep 07, 2017 at 10:03:24AM -0500, Christopher Lameter wrote: > On Thu, 7 Sep 2017, Roman Gushchin wrote: > > > > Really? From what I know and worked on way back when: The reason was to be > > > able to contain the affected application in a cpuset. Multiple apps may

Re: [v7 5/5] mm, oom: cgroup v2 mount option to disable cgroup-aware OOM killer

2017-09-07 Thread Roman Gushchin
On Thu, Sep 07, 2017 at 09:43:30AM -0500, Christopher Lameter wrote: > On Wed, 6 Sep 2017, David Rientjes wrote: > > > > The oom_kill_allocating_task sysctl which causes the OOM killer > > > to simple kill the allocating task is useless. Killing the random > > > task is not the best idea. > > > >

Re: [v7 5/5] mm, oom: cgroup v2 mount option to disable cgroup-aware OOM killer

2017-09-06 Thread Roman Gushchin
sOn Wed, Sep 06, 2017 at 10:42:42AM +0200, Michal Hocko wrote: > On Tue 05-09-17 20:16:09, Roman Gushchin wrote: > > On Tue, Sep 05, 2017 at 05:12:51PM +0200, Michal Hocko wrote: > [...] > > > > Then we should probably hide corresponding > > > > cgroup interfa

Re: [v7 2/5] mm, oom: cgroup-aware OOM killer

2017-09-06 Thread Roman Gushchin
On Wed, Sep 06, 2017 at 03:22:49PM +0200, Michal Hocko wrote: > On Wed 06-09-17 13:57:50, Roman Gushchin wrote: > > On Wed, Sep 06, 2017 at 10:31:58AM +0200, Michal Hocko wrote: > > > On Tue 05-09-17 21:23:57, Roman Gushchin wrote: > > > > On Tue, Sep 05, 2017 at

Re: [v7 2/5] mm, oom: cgroup-aware OOM killer

2017-09-06 Thread Roman Gushchin
On Wed, Sep 06, 2017 at 10:31:58AM +0200, Michal Hocko wrote: > On Tue 05-09-17 21:23:57, Roman Gushchin wrote: > > On Tue, Sep 05, 2017 at 04:57:00PM +0200, Michal Hocko wrote: > [...] > > > Hmm. The changelog says "By default, it will look for the biggest leaf > >

Re: [v7 2/5] mm, oom: cgroup-aware OOM killer

2017-09-06 Thread Roman Gushchin
On Wed, Sep 06, 2017 at 10:34:13AM +0200, Michal Hocko wrote: > On Tue 05-09-17 21:23:57, Roman Gushchin wrote: > > On Tue, Sep 05, 2017 at 04:57:00PM +0200, Michal Hocko wrote: > [...] > > > > @@ -810,6 +810,9 @@ static void __oom_kill_process(struct task

Re: [v7 2/5] mm, oom: cgroup-aware OOM killer

2017-09-05 Thread Roman Gushchin
On Tue, Sep 05, 2017 at 04:57:00PM +0200, Michal Hocko wrote: > On Mon 04-09-17 15:21:05, Roman Gushchin wrote: > [...] > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index a69d23082abf..97813c56163b 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcont

Re: [v7 5/5] mm, oom: cgroup v2 mount option to disable cgroup-aware OOM killer

2017-09-05 Thread Roman Gushchin
On Tue, Sep 05, 2017 at 05:12:51PM +0200, Michal Hocko wrote: > On Tue 05-09-17 15:30:21, Roman Gushchin wrote: > > On Tue, Sep 05, 2017 at 03:44:12PM +0200, Michal Hocko wrote: > [...] > > > Why is this an opt out rather than opt-in? IMHO the original oom logic >

Re: [v7 5/5] mm, oom: cgroup v2 mount option to disable cgroup-aware OOM killer

2017-09-05 Thread Roman Gushchin
On Tue, Sep 05, 2017 at 03:44:12PM +0200, Michal Hocko wrote: > I will go and check patch 2 more deeply but this is something that I > wanted to sort out first. > > On Mon 04-09-17 15:21:08, Roman Gushchin wrote: > > Introducing of cgroup-aware OOM killer changes th

Re: [v7 5/5] mm, oom: cgroup v2 mount option to disable cgroup-aware OOM killer

2017-09-04 Thread Roman Gushchin
On Mon, Sep 04, 2017 at 10:32:37AM -0700, Shakeel Butt wrote: > On Mon, Sep 4, 2017 at 7:21 AM, Roman Gushchin <g...@fb.com> wrote: > > Introducing of cgroup-aware OOM killer changes the victim selection > > algorithm used by default: instead of picking the largest proc

[v7 4/5] mm, oom, docs: describe the cgroup-aware OOM killer

2017-09-04 Thread Roman Gushchin
Update cgroups v2 docs. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> Cc: Andrew Morton

[v7 1/5] mm, oom: refactor the oom_kill_process() function

2017-09-04 Thread Roman Gushchin
selection (considering task's children), so we can't use the existing oom_kill_process(). Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davydov <vdavydov@gmail.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Tetsuo

[v7 0/5] cgroup-aware OOM killer

2017-09-04 Thread Roman Gushchin
ew Morton <a...@linux-foundation.org> Cc: Tejun Heo <t...@kernel.org> Cc: kernel-t...@fb.com Cc: cgro...@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux...@kvack.org Roman Gushchin (5): mm, oom: refactor the oom_kill_process() function m

[v7 3/5] mm, oom: introduce oom_priority for memory cgroups

2017-09-04 Thread Roman Gushchin
sibling cgroups. If two or more sibling cgroups have the same oom_priority, the decision is based on their memory footprint. The root cgroup has the oom_priority 0, which cannot be changed. Signed-off-by: Roman Gushchin <g...@fb.com> Cc: Michal Hocko <mho...@kernel.org> Cc: Vladimir Davyd

Re: [v6 2/4] mm, oom: cgroup-aware OOM killer

2017-08-31 Thread Roman Gushchin
On Wed, Aug 30, 2017 at 01:56:22PM -0700, David Rientjes wrote: > On Wed, 30 Aug 2017, Roman Gushchin wrote: > > > I've spent some time to implement such a version. > > > > It really became shorter and more existing code were reused, > > howewer I've met a couple

Re: [v6 2/4] mm, oom: cgroup-aware OOM killer

2017-08-30 Thread Roman Gushchin
On Fri, Aug 25, 2017 at 10:14:03AM +0200, Michal Hocko wrote: > On Thu 24-08-17 15:58:01, Roman Gushchin wrote: > > On Thu, Aug 24, 2017 at 04:13:37PM +0200, Michal Hocko wrote: > > > On Thu 24-08-17 14:58:42, Roman Gushchin wrote: > [...] > > > > Both ways are no

Re: [v6 2/4] mm, oom: cgroup-aware OOM killer

2017-08-25 Thread Roman Gushchin
Hi David! On Wed, Aug 23, 2017 at 04:19:11PM -0700, David Rientjes wrote: > On Wed, 23 Aug 2017, Roman Gushchin wrote: > > > Traditionally, the OOM killer is operating on a process level. > > Under oom conditions, it finds a process with the highest oom s

Re: [v6 2/4] mm, oom: cgroup-aware OOM killer

2017-08-25 Thread Roman Gushchin
On Fri, Aug 25, 2017 at 10:14:03AM +0200, Michal Hocko wrote: > On Thu 24-08-17 15:58:01, Roman Gushchin wrote: > > On Thu, Aug 24, 2017 at 04:13:37PM +0200, Michal Hocko wrote: > > > On Thu 24-08-17 14:58:42, Roman Gushchin wrote: > [...] > > > > Both ways are no

Re: [v6 2/4] mm, oom: cgroup-aware OOM killer

2017-08-24 Thread Roman Gushchin
On Thu, Aug 24, 2017 at 04:13:37PM +0200, Michal Hocko wrote: > On Thu 24-08-17 14:58:42, Roman Gushchin wrote: > > On Thu, Aug 24, 2017 at 02:58:11PM +0200, Michal Hocko wrote: > > > On Thu 24-08-17 13:28:46, Roman Gushchin wrote: > > > > Hi Michal! > > > &

Re: [v6 2/4] mm, oom: cgroup-aware OOM killer

2017-08-24 Thread Roman Gushchin
On Thu, Aug 24, 2017 at 02:58:11PM +0200, Michal Hocko wrote: > On Thu 24-08-17 13:28:46, Roman Gushchin wrote: > > Hi Michal! > > > There is nothing like a "better victim". We are pretty much in a > catastrophic situation when we try to survive by killing a us

Re: [v6 3/4] mm, oom: introduce oom_priority for memory cgroups

2017-08-24 Thread Roman Gushchin
On Thu, Aug 24, 2017 at 02:10:54PM +0200, Michal Hocko wrote: > On Wed 23-08-17 17:52:00, Roman Gushchin wrote: > > Introduce a per-memory-cgroup oom_priority setting: an integer number > > within the [-1, 1] range, which defines the order in which > > the OOM killer

  1   2   >