Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1697823 > unrolled thread
| Started by | Michal Hocko <mhocko@kernel.org> |
|---|---|
| First post | 2017-07-27 11:10 +0200 |
| Last post | 2017-07-31 08:50 +0200 |
| Articles | 8 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/2] mm, oom: do not grant oom victims full memory reserves access Michal Hocko <mhocko@kernel.org> - 2017-07-27 11:10 +0200
[PATCH 1/2] mm, oom: do not rely on TIF_MEMDIE for memory reserves access Michal Hocko <mhocko@kernel.org> - 2017-07-27 11:10 +0200
[PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim Michal Hocko <mhocko@kernel.org> - 2017-07-27 11:20 +0200
Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-27 16:10 +0200
Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-27 16:10 +0200
Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim Michal Hocko <mhocko@kernel.org> - 2017-07-27 16:20 +0200
Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim Michal Hocko <mhocko@kernel.org> - 2017-07-27 16:50 +0200
Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim Michal Hocko <mhocko@kernel.org> - 2017-07-31 08:50 +0200
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-07-27 11:10 +0200 |
| Subject | [PATCH 0/2] mm, oom: do not grant oom victims full memory reserves access |
| Message-ID | <u7MXU-4d2-17@gated-at.bofh.it> |
Hi, this is a part of a larger series I posted back in Oct last year [1]. I have dropped patch 3 because it was incorrect and patch 4 is not applicable without it. The primary reason to apply patch 1 is to remove a risk of the complete memory depletion by oom victims. While this is a theoretical risk right now there is a demand for memcg aware oom killer which might kill all processes inside a memcg which can be a lot of tasks. That would make the risk quite real. This issue is addressed by limiting access to memory reserves. We no longer use TIF_MEMDIE to grant the access and use tsk_is_oom_victim instead. See Patch 1 for more details. Patch 2 is a trivial follow up cleanup. I would still like to get rid of TIF_MEMDIE completely but I do not have time to do it now and it is not a pressing issue. [1] http://lkml.kernel.org/r/20161004090009.7974-1-mhocko@kernel.org
[toc] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-07-27 11:10 +0200 |
| Subject | [PATCH 1/2] mm, oom: do not rely on TIF_MEMDIE for memory reserves access |
| Message-ID | <u7MXU-4d2-15@gated-at.bofh.it> |
| In reply to | #1697823 |
From: Michal Hocko <mhocko@suse.com>
For ages we have been relying on TIF_MEMDIE thread flag to mark OOM
victims and then, among other things, to give these threads full
access to memory reserves. There are few shortcomings of this
implementation, though.
First of all and the most serious one is that the full access to memory
reserves is quite dangerous because we leave no safety room for the
system to operate and potentially do last emergency steps to move on.
Secondly this flag is per task_struct while the OOM killer operates
on mm_struct granularity so all processes sharing the given mm are
killed. Giving the full access to all these task_structs could lead to
a quick memory reserves depletion. We have tried to reduce this risk by
giving TIF_MEMDIE only to the main thread and the currently allocating
task but that doesn't really solve this problem while it surely opens up
a room for corner cases - e.g. GFP_NO{FS,IO} requests might loop inside
the allocator without access to memory reserves because a particular
thread was not the group leader.
Now that we have the oom reaper and that all oom victims are reapable
after 1b51e65eab64 ("oom, oom_reaper: allow to reap mm shared by the
kthreads") we can be more conservative and grant only partial access to
memory reserves because there are reasonable chances of the parallel
memory freeing. We still want some access to reserves because we do not
want other consumers to eat up the victim's freed memory. oom victims
will still contend with __GFP_HIGH users but those shouldn't be so
aggressive to starve oom victims completely.
Introduce ALLOC_OOM flag and give all tsk_is_oom_victim tasks access to
the half of the reserves. This makes the access to reserves independent
on which task has passed through mark_oom_victim. Also drop any
usage of TIF_MEMDIE from the page allocator proper and replace it by
tsk_is_oom_victim as well which will make page_alloc.c completely
TIF_MEMDIE free finally.
CONFIG_MMU=n doesn't have oom reaper so let's stick to the original
ALLOC_NO_WATERMARKS approach but be careful because they still might
deplete all the memory reserves so keep the semantic as close to the
original implementation as possible and give them access to memory
reserves only up to exit_mm (when tsk->mm is cleared) rather than while
tsk_is_oom_victim which is until signal struct is gone.
There is a demand to make the oom killer memcg aware which will imply
many tasks killed at once. This change will allow such a usecase without
worrying about complete memory reserves depletion.
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
mm/internal.h | 11 +++++++++++
mm/oom_kill.c | 9 +++++----
mm/page_alloc.c | 55 +++++++++++++++++++++++++++++++++++++++++++++----------
3 files changed, 61 insertions(+), 14 deletions(-)
diff --git a/mm/internal.h b/mm/internal.h
index 24d88f084705..1ebcb1ed01b5 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -480,6 +480,17 @@ unsigned long reclaim_clean_pages_from_list(struct zone *zone,
/* Mask to get the watermark bits */
#define ALLOC_WMARK_MASK (ALLOC_NO_WATERMARKS-1)
+/*
+ * Only MMU archs have async oom victim reclaim - aka oom_reaper so we
+ * cannot assume a reduced access to memory reserves is sufficient for
+ * !MMU
+ */
+#ifdef CONFIG_MMU
+#define ALLOC_OOM 0x08
+#else
+#define ALLOC_OOM ALLOC_NO_WATERMARKS
+#endif
+
#define ALLOC_HARDER 0x10 /* try to alloc harder */
#define ALLOC_HIGH 0x20 /* __GFP_HIGH set */
#define ALLOC_CPUSET 0x40 /* check for correct cpuset */
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 9e8b4f030c1c..c9f3569a76c7 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -824,7 +824,8 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
/*
* If the task is already exiting, don't alarm the sysadmin or kill
- * its children or threads, just set TIF_MEMDIE so it can die quickly
+ * its children or threads, just give it access to memory reserves
+ * so it can die quickly
*/
task_lock(p);
if (task_will_free_mem(p)) {
@@ -889,9 +890,9 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
count_memcg_event_mm(mm, OOM_KILL);
/*
- * We should send SIGKILL before setting TIF_MEMDIE in order to prevent
- * the OOM victim from depleting the memory reserves from the user
- * space under its control.
+ * We should send SIGKILL before granting access to memory reserves
+ * in order to prevent the OOM victim from depleting the memory
+ * reserves from the user space under its control.
*/
do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true);
mark_oom_victim(victim);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 80e4adb4c360..5e5911f40014 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2930,7 +2930,7 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
{
long min = mark;
int o;
- const bool alloc_harder = (alloc_flags & ALLOC_HARDER);
+ const bool alloc_harder = (alloc_flags & (ALLOC_HARDER|ALLOC_OOM));
/* free_pages may go negative - that's OK */
free_pages -= (1 << order) - 1;
@@ -2943,10 +2943,19 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
* the high-atomic reserves. This will over-estimate the size of the
* atomic reserve but it avoids a search.
*/
- if (likely(!alloc_harder))
+ if (likely(!alloc_harder)) {
free_pages -= z->nr_reserved_highatomic;
- else
- min -= min / 4;
+ } else {
+ /*
+ * OOM victims can try even harder than normal ALLOC_HARDER
+ * users
+ */
+ if (alloc_flags & ALLOC_OOM)
+ min -= min / 2;
+ else
+ min -= min / 4;
+ }
+
#ifdef CONFIG_CMA
/* If allocation can't use CMA areas don't use free CMA pages */
@@ -3184,7 +3193,7 @@ static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask)
* of allowed nodes.
*/
if (!(gfp_mask & __GFP_NOMEMALLOC))
- if (test_thread_flag(TIF_MEMDIE) ||
+ if (tsk_is_oom_victim(current) ||
(current->flags & (PF_MEMALLOC | PF_EXITING)))
filter &= ~SHOW_MEM_FILTER_NODES;
if (in_interrupt() || !(gfp_mask & __GFP_DIRECT_RECLAIM))
@@ -3603,6 +3612,22 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
return alloc_flags;
}
+static bool oom_reserves_allowed(struct task_struct *tsk)
+{
+ if (!tsk_is_oom_victim(tsk))
+ return false;
+
+ /*
+ * !MMU doesn't have oom reaper so we shouldn't risk the memory reserves
+ * depletion and shouldn't give access to memory reserves passed the
+ * exit_mm
+ */
+ if (!IS_ENABLED(CONFIG_MMU) && !tsk->mm)
+ return false;
+
+ return true;
+}
+
bool gfp_pfmemalloc_allowed(gfp_t gfp_mask)
{
if (unlikely(gfp_mask & __GFP_NOMEMALLOC))
@@ -3614,7 +3639,7 @@ bool gfp_pfmemalloc_allowed(gfp_t gfp_mask)
return true;
if (!in_interrupt() &&
((current->flags & PF_MEMALLOC) ||
- unlikely(test_thread_flag(TIF_MEMDIE))))
+ oom_reserves_allowed(current)))
return true;
return false;
@@ -3770,6 +3795,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
unsigned long alloc_start = jiffies;
unsigned int stall_timeout = 10 * HZ;
unsigned int cpuset_mems_cookie;
+ bool reserves;
/*
* In the slowpath, we sanity check order to avoid ever trying to
@@ -3875,15 +3901,24 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
if (gfp_mask & __GFP_KSWAPD_RECLAIM)
wake_all_kswapds(order, ac);
- if (gfp_pfmemalloc_allowed(gfp_mask))
- alloc_flags = ALLOC_NO_WATERMARKS;
+ /*
+ * Distinguish requests which really need access to whole memory
+ * reserves from oom victims which can live with their own reserve
+ */
+ reserves = gfp_pfmemalloc_allowed(gfp_mask);
+ if (reserves) {
+ if (tsk_is_oom_victim(current))
+ alloc_flags = ALLOC_OOM;
+ else
+ alloc_flags = ALLOC_NO_WATERMARKS;
+ }
/*
* Reset the zonelist iterators if memory policies can be ignored.
* These allocations are high priority and system rather than user
* orientated.
*/
- if (!(alloc_flags & ALLOC_CPUSET) || (alloc_flags & ALLOC_NO_WATERMARKS)) {
+ if (!(alloc_flags & ALLOC_CPUSET) || reserves) {
ac->zonelist = node_zonelist(numa_node_id(), gfp_mask);
ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
ac->high_zoneidx, ac->nodemask);
@@ -3960,7 +3995,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
goto got_pg;
/* Avoid allocations with no watermarks from looping endlessly */
- if (test_thread_flag(TIF_MEMDIE) &&
+ if (tsk_is_oom_victim(current) &&
(alloc_flags == ALLOC_NO_WATERMARKS ||
(gfp_mask & __GFP_NOMEMALLOC)))
goto nopage;
--
2.13.2
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-07-27 11:20 +0200 |
| Subject | [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim |
| Message-ID | <u7N7z-4g8-7@gated-at.bofh.it> |
| In reply to | #1697823 |
From: Michal Hocko <mhocko@suse.com> TIF_MEMDIE is set only to the tasks whick were either directly selected by the OOM killer or passed through mark_oom_victim from the allocator path. tsk_is_oom_victim is more generic and allows to identify all tasks (threads) which share the mm with the oom victim. Please note that the freezer still needs to check TIF_MEMDIE because we cannot thaw tasks which do not participage in oom_victims counting otherwise a !TIF_MEMDIE task could interfere after oom_disbale returns. Signed-off-by: Michal Hocko <mhocko@suse.com> --- kernel/cgroup/cpuset.c | 8 ++++---- mm/memcontrol.c | 2 +- mm/oom_kill.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index ca8376e5008c..1cc53dff0d94 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2497,12 +2497,12 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs) * If we're in interrupt, yes, we can always allocate. If @node is set in * current's mems_allowed, yes. If it's not a __GFP_HARDWALL request and this * node is set in the nearest hardwalled cpuset ancestor to current's cpuset, - * yes. If current has access to memory reserves due to TIF_MEMDIE, yes. + * yes. If current has access to memory reserves as an oom victim, yes. * Otherwise, no. * * GFP_USER allocations are marked with the __GFP_HARDWALL bit, * and do not allow allocations outside the current tasks cpuset - * unless the task has been OOM killed as is marked TIF_MEMDIE. + * unless the task has been OOM killed. * GFP_KERNEL allocations are not so marked, so can escape to the * nearest enclosing hardwalled ancestor cpuset. * @@ -2525,7 +2525,7 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs) * affect that: * in_interrupt - any node ok (current task context irrelevant) * GFP_ATOMIC - any node ok - * TIF_MEMDIE - any node ok + * tsk_is_oom_victim - any node ok * GFP_KERNEL - any node in enclosing hardwalled cpuset ok * GFP_USER - only nodes in current tasks mems allowed ok. */ @@ -2543,7 +2543,7 @@ bool __cpuset_node_allowed(int node, gfp_t gfp_mask) * Allow tasks that have access to memory reserves because they have * been OOM killed to get memory anywhere. */ - if (unlikely(test_thread_flag(TIF_MEMDIE))) + if (unlikely(tsk_is_oom_victim(current))) return true; if (gfp_mask & __GFP_HARDWALL) /* If hardwall request, stop here */ return false; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 544d47e5cbbd..86a48affb938 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1896,7 +1896,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, * bypass the last charges so that they can exit quickly and * free their memory. */ - if (unlikely(test_thread_flag(TIF_MEMDIE) || + if (unlikely(tsk_is_oom_victim(current) || fatal_signal_pending(current) || current->flags & PF_EXITING)) goto force; diff --git a/mm/oom_kill.c b/mm/oom_kill.c index c9f3569a76c7..65cc2f9aaa05 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -483,7 +483,7 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm) * [...] * out_of_memory * select_bad_process - * # no TIF_MEMDIE task selects new victim + * # no TIF_MEMDIE, selects new victim * unmap_page_range # frees some memory */ mutex_lock(&oom_lock); -- 2.13.2
[toc] | [prev] | [next] | [standalone]
| From | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
|---|---|
| Date | 2017-07-27 16:10 +0200 |
| Subject | Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim |
| Message-ID | <u7REe-767-5@gated-at.bofh.it> |
| In reply to | #1697834 |
Tetsuo Handa wrote: > Michal Hocko wrote: > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index 544d47e5cbbd..86a48affb938 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -1896,7 +1896,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > > * bypass the last charges so that they can exit quickly and > > * free their memory. > > */ > > - if (unlikely(test_thread_flag(TIF_MEMDIE) || > > + if (unlikely(tsk_is_oom_victim(current) || > > fatal_signal_pending(current) || > > current->flags & PF_EXITING)) > > goto force; > > Did we check http://lkml.kernel.org/r/20160909140508.GO4844@dhcp22.suse.cz ? > > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > > index c9f3569a76c7..65cc2f9aaa05 100644 > > --- a/mm/oom_kill.c > > +++ b/mm/oom_kill.c > > @@ -483,7 +483,7 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm) > > * [...] > > * out_of_memory > > * select_bad_process > > - * # no TIF_MEMDIE task selects new victim > > + * # no TIF_MEMDIE, selects new victim > > * unmap_page_range # frees some memory > > */ > > mutex_lock(&oom_lock); > > This comment is wrong. No MMF_OOM_SKIP mm selects new victim. > Oops. "MMF_OOM_SKIP mm selects new victim." according to http://lkml.kernel.org/r/201706271952.FEB21375.SFJFHOQLOtVOMF@I-love.SAKURA.ne.jp .
[toc] | [prev] | [next] | [standalone]
| From | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
|---|---|
| Date | 2017-07-27 16:10 +0200 |
| Subject | Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim |
| Message-ID | <u7REe-767-7@gated-at.bofh.it> |
| In reply to | #1697834 |
Michal Hocko wrote: > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 544d47e5cbbd..86a48affb938 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1896,7 +1896,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > * bypass the last charges so that they can exit quickly and > * free their memory. > */ > - if (unlikely(test_thread_flag(TIF_MEMDIE) || > + if (unlikely(tsk_is_oom_victim(current) || > fatal_signal_pending(current) || > current->flags & PF_EXITING)) > goto force; Did we check http://lkml.kernel.org/r/20160909140508.GO4844@dhcp22.suse.cz ? > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index c9f3569a76c7..65cc2f9aaa05 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -483,7 +483,7 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm) > * [...] > * out_of_memory > * select_bad_process > - * # no TIF_MEMDIE task selects new victim > + * # no TIF_MEMDIE, selects new victim > * unmap_page_range # frees some memory > */ > mutex_lock(&oom_lock); This comment is wrong. No MMF_OOM_SKIP mm selects new victim.
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-07-27 16:20 +0200 |
| Subject | Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim |
| Message-ID | <u7RNU-79J-21@gated-at.bofh.it> |
| In reply to | #1698012 |
On Thu 27-07-17 23:01:05, Tetsuo Handa wrote: > Michal Hocko wrote: > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index 544d47e5cbbd..86a48affb938 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -1896,7 +1896,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > > * bypass the last charges so that they can exit quickly and > > * free their memory. > > */ > > - if (unlikely(test_thread_flag(TIF_MEMDIE) || > > + if (unlikely(tsk_is_oom_victim(current) || > > fatal_signal_pending(current) || > > current->flags & PF_EXITING)) > > goto force; > > Did we check http://lkml.kernel.org/r/20160909140508.GO4844@dhcp22.suse.cz ? I will double check. > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > > index c9f3569a76c7..65cc2f9aaa05 100644 > > --- a/mm/oom_kill.c > > +++ b/mm/oom_kill.c > > @@ -483,7 +483,7 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm) > > * [...] > > * out_of_memory > > * select_bad_process > > - * # no TIF_MEMDIE task selects new victim > > + * # no TIF_MEMDIE, selects new victim > > * unmap_page_range # frees some memory > > */ > > mutex_lock(&oom_lock); > > This comment is wrong. No MMF_OOM_SKIP mm selects new victim. This hunk shouldn't make it to the patch. -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-07-27 16:50 +0200 |
| Subject | Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim |
| Message-ID | <u7SgX-7jy-29@gated-at.bofh.it> |
| In reply to | #1698012 |
On Thu 27-07-17 23:01:05, Tetsuo Handa wrote: > Michal Hocko wrote: > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index 544d47e5cbbd..86a48affb938 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -1896,7 +1896,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > > * bypass the last charges so that they can exit quickly and > > * free their memory. > > */ > > - if (unlikely(test_thread_flag(TIF_MEMDIE) || > > + if (unlikely(tsk_is_oom_victim(current) || > > fatal_signal_pending(current) || > > current->flags & PF_EXITING)) > > goto force; > > Did we check http://lkml.kernel.org/r/20160909140508.GO4844@dhcp22.suse.cz ? OK, so your concern was > Does this test_thread_flag(TIF_MEMDIE) (or tsk_is_oom_victim(current)) make sense? > > If current thread is OOM-killed, SIGKILL must be pending before arriving at > do_exit() and PF_EXITING must be set after arriving at do_exit(). > But I can't find locations which do memory allocation between clearing > SIGKILL and setting PF_EXITING. I can't find them either and maybe there are none. But why do we care in this particular patch which merely replaces TIF_MEMDIE check by tsk_is_oom_victim? The code will surely not become less valid. If you believe this check is redundant then send a patch with the clear justification. But I would say, at least from the robustness point of view I would just keep it there. We do not really have any control on what happens between clearing signals and setting PF_EXITING. -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-07-31 08:50 +0200 |
| Subject | Re: [PATCH 2/2] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim |
| Message-ID | <u9cGC-2SJ-7@gated-at.bofh.it> |
| In reply to | #1697834 |
On Sat 29-07-17 16:33:35, kbuild test robot wrote:
> Hi Michal,
>
> [auto build test ERROR on cgroup/for-next]
> [also build test ERROR on v4.13-rc2 next-20170728]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Michal-Hocko/mm-oom-do-not-rely-on-TIF_MEMDIE-for-memory-reserves-access/20170728-101955
> base: https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-next
> config: i386-randconfig-c0-07291424 (attached as .config)
> compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/ioport.h:12:0,
> from include/linux/device.h:16,
> from include/linux/node.h:17,
> from include/linux/cpu.h:16,
> from kernel/cgroup/cpuset.c:25:
> kernel/cgroup/cpuset.c: In function '__cpuset_node_allowed':
> >> include/linux/compiler.h:123:18: error: implicit declaration of function 'tsk_is_oom_victim' [-Werror=implicit-function-declaration]
Thanks for the report. We need this
---
commit 638b5ab1ed275f23b52a71941b66c8966d332cd7
Author: Michal Hocko <mhocko@suse.com>
Date: Mon Jul 31 08:45:53 2017 +0200
fold me
- fix implicit declaration of function 'tsk_is_oom_victim' reported by
0day
Signed-off-by: Michal Hocko <mhocko@suse.com>
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 1cc53dff0d94..734ae4fa9775 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -56,6 +56,7 @@
#include <linux/time64.h>
#include <linux/backing-dev.h>
#include <linux/sort.h>
+#include <linux/oom.h>
#include <linux/uaccess.h>
#include <linux/atomic.h>
--
Michal Hocko
SUSE Labs
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web