Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1292443 > unrolled thread
| Started by | Michal Hocko <mhocko@kernel.org> |
|---|---|
| First post | 2015-12-15 19:30 +0100 |
| Last post | 2015-12-29 17:30 +0100 |
| Articles | 14 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH 0/3] OOM detection rework v4 Michal Hocko <mhocko@kernel.org> - 2015-12-15 19:30 +0100
[PATCH 2/3] mm: throttle on IO only when there are too many dirty and writeback pages Michal Hocko <mhocko@kernel.org> - 2015-12-15 19:30 +0100
[PATCH 1/3] mm, oom: rework oom detection Michal Hocko <mhocko@kernel.org> - 2015-12-15 19:30 +0100
Re: [PATCH 0/3] OOM detection rework v4 Andrew Morton <akpm@linux-foundation.org> - 2015-12-17 00:40 +0100
Re: [PATCH 0/3] OOM detection rework v4 Michal Hocko <mhocko@kernel.org> - 2015-12-18 13:20 +0100
Re: [PATCH 0/3] OOM detection rework v4 Andrew Morton <akpm@linux-foundation.org> - 2015-12-17 01:00 +0100
Re: [PATCH 0/3] OOM detection rework v4 Michal Hocko <mhocko@kernel.org> - 2015-12-18 14:20 +0100
Re: [PATCH 0/3] OOM detection rework v4 Johannes Weiner <hannes@cmpxchg.org> - 2015-12-18 17:40 +0100
Re: [PATCH 0/3] OOM detection rework v4 Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2015-12-24 13:50 +0100
Re: [PATCH 0/3] OOM detection rework v4 Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2015-12-28 13:10 +0100
Re: [PATCH 0/3] OOM detection rework v4 Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2015-12-28 15:20 +0100
Re: [PATCH 0/3] OOM detection rework v4 Michal Hocko <mhocko@kernel.org> - 2015-12-29 17:40 +0100
Re: [PATCH 0/3] OOM detection rework v4 Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2015-12-30 16:10 +0100
Re: [PATCH 0/3] OOM detection rework v4 Michal Hocko <mhocko@kernel.org> - 2015-12-29 17:30 +0100
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2015-12-15 19:30 +0100 |
| Subject | [PATCH 0/3] OOM detection rework v4 |
| Message-ID | <qG2wi-7PJ-13@gated-at.bofh.it> |
Hi,
This is v4 of the series. The previous version was posted [1]. I have
dropped the RFC because this has been sitting and waiting for the
fundamental objections for quite some time and there were none. I still
do not think we should rush this and merge it no sooner than 4.6. Having
this in the mmotm and thus linux-next would open it to a much larger
testing coverage. I will iron out issues as they come but hopefully
there will no serious ones.
* Changes since v3
- factor out the new heuristic into its own function as suggested by
Johannes (no functional changes)
* Changes since v2
- rebased on top of mmotm-2015-11-25-17-08 which includes
wait_iff_congested related changes which needed refresh in
patch#1 and patch#2
- use zone_page_state_snapshot for NR_FREE_PAGES per David
- shrink_zones doesn't need to return anything per David
- retested because the major kernel version has changed since
the last time (4.2 -> 4.3 based kernel + mmotm patches)
* Changes since v1
- backoff calculation was de-obfuscated by using DIV_ROUND_UP
- __GFP_NOFAIL high order migh fail fixed - theoretical bug
as pointed by Linus [2][3] relying on zone_reclaimable as a way to
communicate the reclaim progress is rater dubious. I tend to agree,
not only it is really obscure, it is not hard to imagine cases where a
single page freed in the loop keeps all the reclaimers looping without
getting any progress because their gfp_mask wouldn't allow to get that
page anyway (e.g. single GFP_ATOMIC alloc and free loop). This is rather
rare so it doesn't happen in the practice but the current logic which we
have is rather obscure and hard to follow a also non-deterministic.
This is an attempt to make the OOM detection more deterministic and
easier to follow because each reclaimer basically tracks its own
progress which is implemented at the page allocator layer rather spread
out between the allocator and the reclaim. The more on the implementation
is described in the first patch.
I have tested several different scenarios but it should be clear that
testing OOM killer is quite hard to be representative. There is usually
a tiny gap between almost OOM and full blown OOM which is often time
sensitive. Anyway, I have tested the following 3 scenarios and I would
appreciate if there are more to test.
Testing environment: a virtual machine with 2G of RAM and 2CPUs without
any swap to make the OOM more deterministic.
1) 2 writers (each doing dd with 4M blocks to an xfs partition with 1G size,
removes the files and starts over again) running in parallel for 10s
to build up a lot of dirty pages when 100 parallel mem_eaters (anon
private populated mmap which waits until it gets signal) with 80M
each.
This causes an OOM flood of course and I have compared both patched
and unpatched kernels. The test is considered finished after there
are no OOM conditions detected. This should tell us whether there are
any excessive kills or some of them premature:
I have performed two runs this time each after a fresh boot.
* base kernel
$ grep "Killed process" base-oom-run1.log | tail -n1
[ 211.824379] Killed process 3086 (mem_eater) total-vm:85852kB, anon-rss:81996kB, file-rss:332kB, shmem-rss:0kB
$ grep "Killed process" base-oom-run2.log | tail -n1
[ 157.188326] Killed process 3094 (mem_eater) total-vm:85852kB, anon-rss:81996kB, file-rss:368kB, shmem-rss:0kB
$ grep "invoked oom-killer" base-oom-run1.log | wc -l
78
$ grep "invoked oom-killer" base-oom-run2.log | wc -l
76
The number of OOM invocations is consistent with my last measurements
but the runtime is way too different (it took 800+s). One thing that
could have skewed results was that I was tail -f the serial log on the
host system to see the progress. I have stopped doing that. The results
are more consistent now but still too different from the last time.
This is really weird so I've retested with the last 4.2 mmotm again and
I am getting consistent ~220s which is really close to the above. If I
apply the WQ vmstat patch on top I am getting close to 160s so the stale
vmstat counters made a difference which is to be expected. I have a new
SSD in my laptop which migh have made a difference but I wouldn't expect
it to be that large.
$ grep "DMA32.*all_unreclaimable? no" base-oom-run1.log | wc -l
4
$ grep "DMA32.*all_unreclaimable? no" base-oom-run2.log | wc -l
1
* patched kernel
$ grep "Killed process" patched-oom-run1.log | tail -n1
[ 341.164930] Killed process 3099 (mem_eater) total-vm:85852kB, anon-rss:82000kB, file-rss:336kB, shmem-rss:0kB
$ grep "Killed process" patched-oom-run2.log | tail -n1
[ 349.111539] Killed process 3082 (mem_eater) total-vm:85852kB, anon-rss:81996kB, file-rss:4kB, shmem-rss:0kB
$ grep "invoked oom-killer" patched-oom-run1.log | wc -l
78
$ grep "invoked oom-killer" patched-oom-run2.log | wc -l
77
$ grep "DMA32.*all_unreclaimable? no" patched-oom-run1.log | wc -l
1
$ grep "DMA32.*all_unreclaimable? no" patched-oom-run2.log | wc -l
0
So the number of OOM killer invocation is the same but the overall
runtime of the test was much longer with the patched kernel. This can be
attributed to more retries in general. The results from the base kernel
are quite inconsitent and I think that consistency is better here.
2) 2 writers again with 10s of run and then 10 mem_eaters to consume as much
memory as possible without triggering the OOM killer. This required a lot
of tuning but I've considered 3 consecutive runs without OOM as a success.
* base kernel
size=$(awk '/MemFree/{printf "%dK", ($2/10)-(15*1024)}' /proc/meminfo)
* patched kernel
size=$(awk '/MemFree/{printf "%dK", ($2/10)-(9*1024)}' /proc/meminfo)
It was -14M for the base 4.2 kernel and -7500M for the patched 4.2 kernel in
my last measurements.
The patched kernel handled the low mem conditions better and fired OOM
killer later.
3) Costly high-order allocations with a limited amount of memory.
Start 10 memeaters in parallel each with
size=$(awk '/MemTotal/{printf "%d\n", $2/10}' /proc/meminfo)
This will cause an OOM killer which will kill one of them which will free up
200M and then try to use all the remaining space for hugetlb pages. See how
many of them will pass kill everything, wait 2s and try again.
This tests whether we do not fail __GFP_REPEAT costly allocations too early
now.
* base kernel
$ sort base-hugepages.log | uniq -c
1 64
13 65
6 66
20 Trying to allocate 73
* patched kernel
$ sort patched-hugepages.log | uniq -c
17 65
3 66
20 Trying to allocate 73
This also doesn't look very bad but this particular test is quite timing
sensitive.
The above results do seem optimistic but more loads should be tested
obviously. I would really appreciate a feedback on the approach I have
chosen before I go into more tuning. Is this viable way to go?
[1] http://lkml.kernel.org/r/1448974607-10208-1-git-send-email-mhocko@kernel.org
[2] http://lkml.kernel.org/r/CA+55aFwapaED7JV6zm-NVkP-jKie+eQ1vDXWrKD=SkbshZSgmw@mail.gmail.com
[3] http://lkml.kernel.org/r/CA+55aFxwg=vS2nrXsQhAUzPQDGb8aQpZi0M7UUh21ftBo-z46Q@mail.gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2015-12-15 19:30 +0100 |
| Subject | [PATCH 2/3] mm: throttle on IO only when there are too many dirty and writeback pages |
| Message-ID | <qG2wj-7PJ-25@gated-at.bofh.it> |
| In reply to | #1292443 |
From: Michal Hocko <mhocko@suse.com>
wait_iff_congested has been used to throttle allocator before it retried
another round of direct reclaim to allow the writeback to make some
progress and prevent reclaim from looping over dirty/writeback pages
without making any progress. We used to do congestion_wait before
0e093d99763e ("writeback: do not sleep on the congestion queue if
there are no congested BDIs or if significant congestion is not being
encountered in the current zone") but that led to undesirable stalls
and sleeping for the full timeout even when the BDI wasn't congested.
Hence wait_iff_congested was used instead. But it seems that even
wait_iff_congested doesn't work as expected. We might have a small file
LRU list with all pages dirty/writeback and yet the bdi is not congested
so this is just a cond_resched in the end and can end up triggering pre
mature OOM.
This patch replaces the unconditional wait_iff_congested by
congestion_wait which is executed only if we _know_ that the last round
of direct reclaim didn't make any progress and dirty+writeback pages are
more than a half of the reclaimable pages on the zone which might be
usable for our target allocation. This shouldn't reintroduce stalls
fixed by 0e093d99763e because congestion_wait is called only when we
are getting hopeless when sleeping is a better choice than OOM with many
pages under IO.
We have to preserve logic introduced by "mm, vmstat: allow WQ concurrency
to discover memory reclaim doesn't make any progress" into the
__alloc_pages_slowpath now that wait_iff_congested is not used anymore.
As the only remaining user of wait_iff_congested is shrink_inactive_list
we can remove the WQ specific short sleep from wait_iff_congested
because the sleep is needed to be done only once in the allocation retry
cycle.
Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
mm/backing-dev.c | 19 +++----------------
mm/page_alloc.c | 36 +++++++++++++++++++++++++++++++++---
2 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 7340353f8aea..d2473ce9cc57 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -957,9 +957,8 @@ EXPORT_SYMBOL(congestion_wait);
* jiffies for either a BDI to exit congestion of the given @sync queue
* or a write to complete.
*
- * In the absence of zone congestion, a short sleep or a cond_resched is
- * performed to yield the processor and to allow other subsystems to make
- * a forward progress.
+ * In the absence of zone congestion, cond_resched() is called to yield
+ * the processor if necessary but otherwise does not sleep.
*
* The return value is 0 if the sleep is for the full timeout. Otherwise,
* it is the number of jiffies that were still remaining when the function
@@ -980,19 +979,7 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout)
if (atomic_read(&nr_wb_congested[sync]) == 0 ||
!test_bit(ZONE_CONGESTED, &zone->flags)) {
- /*
- * Memory allocation/reclaim might be called from a WQ
- * context and the current implementation of the WQ
- * concurrency control doesn't recognize that a particular
- * WQ is congested if the worker thread is looping without
- * ever sleeping. Therefore we have to do a short sleep
- * here rather than calling cond_resched().
- */
- if (current->flags & PF_WQ_WORKER)
- schedule_timeout(1);
- else
- cond_resched();
-
+ cond_resched();
/* In case we scheduled, work out time remaining */
ret = timeout - (jiffies - start);
if (ret < 0)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f77e283fb8c6..b2de8c8761ad 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3034,8 +3034,9 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order,
*/
for_each_zone_zonelist_nodemask(zone, z, ac->zonelist, ac->high_zoneidx, ac->nodemask) {
unsigned long available;
+ unsigned long reclaimable;
- available = zone_reclaimable_pages(zone);
+ available = reclaimable = zone_reclaimable_pages(zone);
available -= DIV_ROUND_UP(no_progress_loops * available, MAX_RECLAIM_RETRIES);
available += zone_page_state_snapshot(zone, NR_FREE_PAGES);
@@ -3044,8 +3045,37 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order,
*/
if (__zone_watermark_ok(zone, order, min_wmark_pages(zone),
ac->high_zoneidx, alloc_flags, available)) {
- /* Wait for some write requests to complete then retry */
- wait_iff_congested(zone, BLK_RW_ASYNC, HZ/50);
+ unsigned long writeback;
+ unsigned long dirty;
+
+ writeback = zone_page_state_snapshot(zone, NR_WRITEBACK);
+ dirty = zone_page_state_snapshot(zone, NR_FILE_DIRTY);
+
+ /*
+ * If we didn't make any progress and have a lot of
+ * dirty + writeback pages then we should wait for
+ * an IO to complete to slow down the reclaim and
+ * prevent from pre mature OOM
+ */
+ if (!did_some_progress && 2*(writeback + dirty) > reclaimable) {
+ congestion_wait(BLK_RW_ASYNC, HZ/10);
+ return true;
+ }
+
+ /*
+ * Memory allocation/reclaim might be called from a WQ
+ * context and the current implementation of the WQ
+ * concurrency control doesn't recognize that
+ * a particular WQ is congested if the worker thread is
+ * looping without ever sleeping. Therefore we have to
+ * do a short sleep here rather than calling
+ * cond_resched().
+ */
+ if (current->flags & PF_WQ_WORKER)
+ schedule_timeout(1);
+ else
+ cond_resched();
+
return true;
}
}
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2015-12-15 19:30 +0100 |
| Subject | [PATCH 1/3] mm, oom: rework oom detection |
| Message-ID | <qG2wj-7PJ-27@gated-at.bofh.it> |
| In reply to | #1292443 |
From: Michal Hocko <mhocko@suse.com>
__alloc_pages_slowpath has traditionally relied on the direct reclaim
and did_some_progress as an indicator that it makes sense to retry
allocation rather than declaring OOM. shrink_zones had to rely on
zone_reclaimable if shrink_zone didn't make any progress to prevent
from a premature OOM killer invocation - the LRU might be full of dirty
or writeback pages and direct reclaim cannot clean those up.
zone_reclaimable allows to rescan the reclaimable lists several
times and restart if a page is freed. This is really subtle behavior
and it might lead to a livelock when a single freed page keeps allocator
looping but the current task will not be able to allocate that single
page. OOM killer would be more appropriate than looping without any
progress for unbounded amount of time.
This patch changes OOM detection logic and pulls it out from shrink_zone
which is too low to be appropriate for any high level decisions such as OOM
which is per zonelist property. It is __alloc_pages_slowpath which knows
how many attempts have been done and what was the progress so far
therefore it is more appropriate to implement this logic.
The new heuristic is implemented in should_reclaim_retry helper called
from __alloc_pages_slowpath. It tries to be more deterministic and
easier to follow. It builds on an assumption that retrying makes sense
only if the currently reclaimable memory + free pages would allow the
current allocation request to succeed (as per __zone_watermark_ok) at
least for one zone in the usable zonelist.
This alone wouldn't be sufficient, though, because the writeback might
get stuck and reclaimable pages might be pinned for a really long time
or even depend on the current allocation context. Therefore there is a
feedback mechanism implemented which reduces the reclaim target after
each reclaim round without any progress. This means that we should
eventually converge to only NR_FREE_PAGES as the target and fail on the
wmark check and proceed to OOM. The backoff is simple and linear with
1/16 of the reclaimable pages for each round without any progress. We
are optimistic and reset counter for successful reclaim rounds.
Costly high order pages mostly preserve their semantic and those without
__GFP_REPEAT fail right away while those which have the flag set will
back off after the amount of reclaimable pages reaches equivalent of the
requested order. The only difference is that if there was no progress
during the reclaim we rely on zone watermark check. This is more logical
thing to do than previous 1<<order attempts which were a result of
zone_reclaimable faking the progress.
[hannes@cmpxchg.org: separate the heuristic into should_reclaim_retry]
[rientjes@google.com: use zone_page_state_snapshot for NR_FREE_PAGES]
[rientjes@google.com: shrink_zones doesn't need to return anything]
Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Signed-off-by: Michal Hocko <mhocko@suse.com>
factor out the retry logic into separate function - per Johannes
---
include/linux/swap.h | 1 +
mm/page_alloc.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++-----
mm/vmscan.c | 25 +++------------
3 files changed, 88 insertions(+), 29 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 457181844b6e..738ae2206635 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -316,6 +316,7 @@ extern void lru_cache_add_active_or_unevictable(struct page *page,
struct vm_area_struct *vma);
/* linux/mm/vmscan.c */
+extern unsigned long zone_reclaimable_pages(struct zone *zone);
extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
gfp_t gfp_mask, nodemask_t *mask);
extern int __isolate_lru_page(struct page *page, isolate_mode_t mode);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e267faad4649..f77e283fb8c6 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2984,6 +2984,75 @@ static inline bool is_thp_gfp_mask(gfp_t gfp_mask)
return (gfp_mask & (GFP_TRANSHUGE | __GFP_KSWAPD_RECLAIM)) == GFP_TRANSHUGE;
}
+/*
+ * Maximum number of reclaim retries without any progress before OOM killer
+ * is consider as the only way to move forward.
+ */
+#define MAX_RECLAIM_RETRIES 16
+
+/*
+ * Checks whether it makes sense to retry the reclaim to make a forward progress
+ * for the given allocation request.
+ * The reclaim feedback represented by did_some_progress (any progress during
+ * the last reclaim round), pages_reclaimed (cumulative number of reclaimed
+ * pages) and no_progress_loops (number of reclaim rounds without any progress
+ * in a row) is considered as well as the reclaimable pages on the applicable
+ * zone list (with a backoff mechanism which is a function of no_progress_loops).
+ *
+ * Returns true if a retry is viable or false to enter the oom path.
+ */
+static inline bool
+should_reclaim_retry(gfp_t gfp_mask, unsigned order,
+ struct alloc_context *ac, int alloc_flags,
+ bool did_some_progress, unsigned long pages_reclaimed,
+ int no_progress_loops)
+{
+ struct zone *zone;
+ struct zoneref *z;
+
+ /*
+ * Make sure we converge to OOM if we cannot make any progress
+ * several times in the row.
+ */
+ if (no_progress_loops > MAX_RECLAIM_RETRIES)
+ return false;
+
+ /* Do not retry high order allocations unless they are __GFP_REPEAT */
+ if (order > PAGE_ALLOC_COSTLY_ORDER) {
+ if (!(gfp_mask & __GFP_REPEAT) || pages_reclaimed >= (1<<order))
+ return false;
+
+ if (did_some_progress)
+ return true;
+ }
+
+ /*
+ * Keep reclaiming pages while there is a chance this will lead somewhere.
+ * If none of the target zones can satisfy our allocation request even
+ * if all reclaimable pages are considered then we are screwed and have
+ * to go OOM.
+ */
+ for_each_zone_zonelist_nodemask(zone, z, ac->zonelist, ac->high_zoneidx, ac->nodemask) {
+ unsigned long available;
+
+ available = zone_reclaimable_pages(zone);
+ available -= DIV_ROUND_UP(no_progress_loops * available, MAX_RECLAIM_RETRIES);
+ available += zone_page_state_snapshot(zone, NR_FREE_PAGES);
+
+ /*
+ * Would the allocation succeed if we reclaimed the whole available?
+ */
+ if (__zone_watermark_ok(zone, order, min_wmark_pages(zone),
+ ac->high_zoneidx, alloc_flags, available)) {
+ /* Wait for some write requests to complete then retry */
+ wait_iff_congested(zone, BLK_RW_ASYNC, HZ/50);
+ return true;
+ }
+ }
+
+ return false;
+}
+
static inline struct page *
__alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
struct alloc_context *ac)
@@ -2996,6 +3065,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
enum migrate_mode migration_mode = MIGRATE_ASYNC;
bool deferred_compaction = false;
int contended_compaction = COMPACT_CONTENDED_NONE;
+ int no_progress_loops = 0;
/*
* In the slowpath, we sanity check order to avoid ever trying to
@@ -3155,23 +3225,28 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
if (gfp_mask & __GFP_NORETRY)
goto noretry;
- /* Keep reclaiming pages as long as there is reasonable progress */
- pages_reclaimed += did_some_progress;
- if ((did_some_progress && order <= PAGE_ALLOC_COSTLY_ORDER) ||
- ((gfp_mask & __GFP_REPEAT) && pages_reclaimed < (1 << order))) {
- /* Wait for some write requests to complete then retry */
- wait_iff_congested(ac->preferred_zone, BLK_RW_ASYNC, HZ/50);
- goto retry;
+ if (did_some_progress) {
+ no_progress_loops = 0;
+ pages_reclaimed += did_some_progress;
+ } else {
+ no_progress_loops++;
}
+ if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags,
+ did_some_progress > 0, pages_reclaimed,
+ no_progress_loops))
+ goto retry;
+
/* Reclaim has failed us, start killing things */
page = __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress);
if (page)
goto got_pg;
/* Retry as long as the OOM killer is making progress */
- if (did_some_progress)
+ if (did_some_progress) {
+ no_progress_loops = 0;
goto retry;
+ }
noretry:
/*
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4589cfdbe405..489212252cd6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -192,7 +192,7 @@ static bool sane_reclaim(struct scan_control *sc)
}
#endif
-static unsigned long zone_reclaimable_pages(struct zone *zone)
+unsigned long zone_reclaimable_pages(struct zone *zone)
{
unsigned long nr;
@@ -2516,10 +2516,8 @@ static inline bool compaction_ready(struct zone *zone, int order)
*
* If a zone is deemed to be full of pinned pages then just give it a light
* scan then give up on it.
- *
- * Returns true if a zone was reclaimable.
*/
-static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
+static void shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
{
struct zoneref *z;
struct zone *zone;
@@ -2527,7 +2525,6 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
unsigned long nr_soft_scanned;
gfp_t orig_mask;
enum zone_type requested_highidx = gfp_zone(sc->gfp_mask);
- bool reclaimable = false;
/*
* If the number of buffer_heads in the machine exceeds the maximum
@@ -2592,17 +2589,10 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
&nr_soft_scanned);
sc->nr_reclaimed += nr_soft_reclaimed;
sc->nr_scanned += nr_soft_scanned;
- if (nr_soft_reclaimed)
- reclaimable = true;
/* need some check for avoid more shrink_zone() */
}
- if (shrink_zone(zone, sc, zone_idx(zone) == classzone_idx))
- reclaimable = true;
-
- if (global_reclaim(sc) &&
- !reclaimable && zone_reclaimable(zone))
- reclaimable = true;
+ shrink_zone(zone, sc, zone_idx(zone));
}
/*
@@ -2610,8 +2600,6 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
* promoted it to __GFP_HIGHMEM.
*/
sc->gfp_mask = orig_mask;
-
- return reclaimable;
}
/*
@@ -2636,7 +2624,6 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
int initial_priority = sc->priority;
unsigned long total_scanned = 0;
unsigned long writeback_threshold;
- bool zones_reclaimable;
retry:
delayacct_freepages_start();
@@ -2647,7 +2634,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
vmpressure_prio(sc->gfp_mask, sc->target_mem_cgroup,
sc->priority);
sc->nr_scanned = 0;
- zones_reclaimable = shrink_zones(zonelist, sc);
+ shrink_zones(zonelist, sc);
total_scanned += sc->nr_scanned;
if (sc->nr_reclaimed >= sc->nr_to_reclaim)
@@ -2694,10 +2681,6 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
goto retry;
}
- /* Any of the zones still reclaimable? Don't OOM. */
- if (zones_reclaimable)
- return 1;
-
return 0;
}
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2015-12-17 00:40 +0100 |
| Message-ID | <qGtPP-8mr-1@gated-at.bofh.it> |
| In reply to | #1292443 |
On Tue, 15 Dec 2015 19:19:43 +0100 Michal Hocko <mhocko@kernel.org> wrote: > This is an attempt to make the OOM detection more deterministic and > easier to follow because each reclaimer basically tracks its own > progress which is implemented at the page allocator layer rather spread > out between the allocator and the reclaim. The more on the implementation > is described in the first patch. We've been futzing with this stuff for many years and it still isn't working well. This makes me expect that the new implementation will take a long time to settle in. To aid and accelerate this process I suggest we lard this code up with lots of debug info, so when someone reports an issue we have the best possible chance of understanding what went wrong. This is easy in the case of oom-too-early - it's all slowpath code and we can just do printk(everything). It's not so easy in the case of oom-too-late-or-never. The reporter's machine just hangs or it twiddles thumbs for five minutes then goes oom. But there are things we can do here as well, such as: - add an automatic "nearly oom" detection which detects when things start going wrong and turns on diagnostics (this would need an enable knob, possibly in debugfs). - forget about an autodetector and simply add a debugfs knob to turn on the diagnostics. - sprinkle tracepoints everywhere and provide a set of instructions/scripts so that people who know nothing about kernel internals or tracing can easily gather the info we need to understand issues. - add a sysrq key to turn on diagnostics. Pretty essential when the machine is comatose and doesn't respond to keystrokes. - something else So... please have a think about it? What can we add in here to make it as easy as possible for us (ie: you ;)) to get this code working well? At this time, too much developer support code will be better than too little. We can take it out later on. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2015-12-18 13:20 +0100 |
| Message-ID | <qH2aR-5vD-1@gated-at.bofh.it> |
| In reply to | #1293390 |
On Wed 16-12-15 15:35:13, Andrew Morton wrote: [...] > So... please have a think about it? What can we add in here to make it > as easy as possible for us (ie: you ;)) to get this code working well? > At this time, too much developer support code will be better than too > little. We can take it out later on. Sure. I will think about this and get back to it early next year. I will be mostly offline starting next week. Thanks for looking into this! -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2015-12-17 01:00 +0100 |
| Message-ID | <qGu9c-8tX-7@gated-at.bofh.it> |
| In reply to | #1292443 |
On Tue, 15 Dec 2015 19:19:43 +0100 Michal Hocko <mhocko@kernel.org> wrote: > > ... > > * base kernel > $ grep "Killed process" base-oom-run1.log | tail -n1 > [ 211.824379] Killed process 3086 (mem_eater) total-vm:85852kB, anon-rss:81996kB, file-rss:332kB, shmem-rss:0kB > $ grep "Killed process" base-oom-run2.log | tail -n1 > [ 157.188326] Killed process 3094 (mem_eater) total-vm:85852kB, anon-rss:81996kB, file-rss:368kB, shmem-rss:0kB > > $ grep "invoked oom-killer" base-oom-run1.log | wc -l > 78 > $ grep "invoked oom-killer" base-oom-run2.log | wc -l > 76 > > The number of OOM invocations is consistent with my last measurements > but the runtime is way too different (it took 800+s). I'm seeing 211 seconds vs 157 seconds? If so, that's not toooo bad. I assume the 800+s is sum-across-multiple-CPUs? Given that all the CPUs are pounding away at the same data and the same disk, that doesn't sound like very interesting info - the overall elapsed time is the thing to look at in this case. > One thing that > could have skewed results was that I was tail -f the serial log on the > host system to see the progress. I have stopped doing that. The results > are more consistent now but still too different from the last time. > This is really weird so I've retested with the last 4.2 mmotm again and > I am getting consistent ~220s which is really close to the above. If I > apply the WQ vmstat patch on top I am getting close to 160s so the stale > vmstat counters made a difference which is to be expected. I have a new > SSD in my laptop which migh have made a difference but I wouldn't expect > it to be that large. > > $ grep "DMA32.*all_unreclaimable? no" base-oom-run1.log | wc -l > 4 > $ grep "DMA32.*all_unreclaimable? no" base-oom-run2.log | wc -l > 1 > > * patched kernel > $ grep "Killed process" patched-oom-run1.log | tail -n1 > [ 341.164930] Killed process 3099 (mem_eater) total-vm:85852kB, anon-rss:82000kB, file-rss:336kB, shmem-rss:0kB > $ grep "Killed process" patched-oom-run2.log | tail -n1 > [ 349.111539] Killed process 3082 (mem_eater) total-vm:85852kB, anon-rss:81996kB, file-rss:4kB, shmem-rss:0kB Even better. > $ grep "invoked oom-killer" patched-oom-run1.log | wc -l > 78 > $ grep "invoked oom-killer" patched-oom-run2.log | wc -l > 77 > > $ grep "DMA32.*all_unreclaimable? no" patched-oom-run1.log | wc -l > 1 > $ grep "DMA32.*all_unreclaimable? no" patched-oom-run2.log | wc -l > 0 > > So the number of OOM killer invocation is the same but the overall > runtime of the test was much longer with the patched kernel. This can be > attributed to more retries in general. The results from the base kernel > are quite inconsitent and I think that consistency is better here. It's hard to say how long declaration of oom should take. Correctness comes first. But what is "correct"? oom isn't a binary condition - there's a chance that if we keep churning away for another 5 minutes we'll be able to satisfy this allocation (but probably not the next one). There are tradeoffs between promptness-of-declaring-oom and exhaustiveness-in-avoiding-it. > > 2) 2 writers again with 10s of run and then 10 mem_eaters to consume as much > memory as possible without triggering the OOM killer. This required a lot > of tuning but I've considered 3 consecutive runs without OOM as a success. "a lot of tuning" sounds bad. It means that the tuning settings you have now for a particular workload on a particular machine will be wrong for other workloads and machines. uh-oh. > ... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2015-12-18 14:20 +0100 |
| Message-ID | <qH36W-682-3@gated-at.bofh.it> |
| In reply to | #1293405 |
On Wed 16-12-15 15:58:44, Andrew Morton wrote: > On Tue, 15 Dec 2015 19:19:43 +0100 Michal Hocko <mhocko@kernel.org> wrote: > > > > > ... > > > > * base kernel > > $ grep "Killed process" base-oom-run1.log | tail -n1 > > [ 211.824379] Killed process 3086 (mem_eater) total-vm:85852kB, anon-rss:81996kB, file-rss:332kB, shmem-rss:0kB > > $ grep "Killed process" base-oom-run2.log | tail -n1 > > [ 157.188326] Killed process 3094 (mem_eater) total-vm:85852kB, anon-rss:81996kB, file-rss:368kB, shmem-rss:0kB > > > > $ grep "invoked oom-killer" base-oom-run1.log | wc -l > > 78 > > $ grep "invoked oom-killer" base-oom-run2.log | wc -l > > 76 > > > > The number of OOM invocations is consistent with my last measurements > > but the runtime is way too different (it took 800+s). > > I'm seeing 211 seconds vs 157 seconds? If so, that's not toooo bad. I > assume the 800+s is sum-across-multiple-CPUs? This is the time until the oom situation settled down. And I really suspect that the new SSD made a difference here. > Given that all the CPUs > are pounding away at the same data and the same disk, that doesn't > sound like very interesting info - the overall elapsed time is the > thing to look at in this case. Which is what I was looking at when checking the timestamp in the log. [...] > > * patched kernel > > $ grep "Killed process" patched-oom-run1.log | tail -n1 > > [ 341.164930] Killed process 3099 (mem_eater) total-vm:85852kB, anon-rss:82000kB, file-rss:336kB, shmem-rss:0kB > > $ grep "Killed process" patched-oom-run2.log | tail -n1 > > [ 349.111539] Killed process 3082 (mem_eater) total-vm:85852kB, anon-rss:81996kB, file-rss:4kB, shmem-rss:0kB > > Even better. > > > $ grep "invoked oom-killer" patched-oom-run1.log | wc -l > > 78 > > $ grep "invoked oom-killer" patched-oom-run2.log | wc -l > > 77 > > > > $ grep "DMA32.*all_unreclaimable? no" patched-oom-run1.log | wc -l > > 1 > > $ grep "DMA32.*all_unreclaimable? no" patched-oom-run2.log | wc -l > > 0 > > > > So the number of OOM killer invocation is the same but the overall > > runtime of the test was much longer with the patched kernel. This can be > > attributed to more retries in general. The results from the base kernel > > are quite inconsitent and I think that consistency is better here. > > It's hard to say how long declaration of oom should take. Correctness > comes first. But what is "correct"? oom isn't a binary condition - > there's a chance that if we keep churning away for another 5 minutes > we'll be able to satisfy this allocation (but probably not the next > one). There are tradeoffs between promptness-of-declaring-oom and > exhaustiveness-in-avoiding-it. Yes, this is really hard to tell. What I wanted to achieve here is a determinism - the same load should give comparable results. It seems that there is an improvement in this regards. The time to settle is much more consistent than with the original implementation. > > 2) 2 writers again with 10s of run and then 10 mem_eaters to consume as much > > memory as possible without triggering the OOM killer. This required a lot > > of tuning but I've considered 3 consecutive runs without OOM as a success. > > "a lot of tuning" sounds bad. It means that the tuning settings you > have now for a particular workload on a particular machine will be > wrong for other workloads and machines. uh-oh. Well, I had to tune the test to see how close to the edge I can get. I haven't done any decisions based on this test. Thanks! -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Date | 2015-12-18 17:40 +0100 |
| Message-ID | <qH6et-82w-5@gated-at.bofh.it> |
| In reply to | #1294804 |
On Fri, Dec 18, 2015 at 02:15:09PM +0100, Michal Hocko wrote: > On Wed 16-12-15 15:58:44, Andrew Morton wrote: > > It's hard to say how long declaration of oom should take. Correctness > > comes first. But what is "correct"? oom isn't a binary condition - > > there's a chance that if we keep churning away for another 5 minutes > > we'll be able to satisfy this allocation (but probably not the next > > one). There are tradeoffs between promptness-of-declaring-oom and > > exhaustiveness-in-avoiding-it. > > Yes, this is really hard to tell. What I wanted to achieve here is a > determinism - the same load should give comparable results. It seems > that there is an improvement in this regards. The time to settle is > much more consistent than with the original implementation. +1 Before that we couldn't even really make a meaningful statement about how long we are going to try - "as long as reclaim thinks it can maybe do some more, depending on heuristics". I think the best thing we can strive for with OOM is to make the rules simple and predictable. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
|---|---|
| Date | 2015-12-24 13:50 +0100 |
| Message-ID | <qJdvd-6KI-35@gated-at.bofh.it> |
| In reply to | #1292443 |
I got OOM killers while running heavy disk I/O (extracting kernel source, running lxr's genxref command). (Environ: 4 CPUs / 2048MB RAM / no swap / XFS) Do you think these OOM killers reasonable? Too weak against fragmentation? [ 3902.430630] kthreadd invoked oom-killer: order=2, oom_score_adj=0, gfp_mask=0x27000c0(GFP_KERNEL|GFP_NOTRACK|0x100000) [ 3902.432780] kthreadd cpuset=/ mems_allowed=0 [ 3902.433904] CPU: 3 PID: 2 Comm: kthreadd Not tainted 4.4.0-rc6-next-20151222 #255 [ 3902.435463] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013 [ 3902.437541] 0000000000000000 000000009cc7eb67 ffff88007cc1faa0 ffffffff81395bc3 [ 3902.439129] 0000000000000000 ffff88007cc1fb40 ffffffff811babac 0000000000000206 [ 3902.440779] ffffffff81810470 ffff88007cc1fae0 ffffffff810bce29 0000000000000206 [ 3902.442436] Call Trace: [ 3902.443094] [<ffffffff81395bc3>] dump_stack+0x4b/0x68 [ 3902.444188] [<ffffffff811babac>] dump_header+0x5b/0x3b0 [ 3902.445301] [<ffffffff810bce29>] ? trace_hardirqs_on_caller+0xf9/0x1c0 [ 3902.446656] [<ffffffff810bcefd>] ? trace_hardirqs_on+0xd/0x10 [ 3902.447881] [<ffffffff81142646>] oom_kill_process+0x366/0x540 [ 3902.449093] [<ffffffff81142a5f>] out_of_memory+0x1ef/0x5a0 [ 3902.450266] [<ffffffff81142b1d>] ? out_of_memory+0x2ad/0x5a0 [ 3902.451430] [<ffffffff8114836d>] __alloc_pages_nodemask+0xb9d/0xd90 [ 3902.452757] [<ffffffff810bce00>] ? trace_hardirqs_on_caller+0xd0/0x1c0 [ 3902.454468] [<ffffffff8114871c>] alloc_kmem_pages_node+0x4c/0xc0 [ 3902.455756] [<ffffffff8106c451>] copy_process.part.31+0x131/0x1b40 [ 3902.457076] [<ffffffff8108f590>] ? kthread_create_on_node+0x230/0x230 [ 3902.458396] [<ffffffff8106e02b>] _do_fork+0xdb/0x5d0 [ 3902.459480] [<ffffffff81094a8a>] ? finish_task_switch+0x6a/0x2b0 [ 3902.460775] [<ffffffff8106e544>] kernel_thread+0x24/0x30 [ 3902.461894] [<ffffffff8109007c>] kthreadd+0x1bc/0x220 [ 3902.463035] [<ffffffff816fc89f>] ? ret_from_fork+0x3f/0x70 [ 3902.464230] [<ffffffff8108fec0>] ? kthread_create_on_cpu+0x60/0x60 [ 3902.465502] [<ffffffff816fc89f>] ret_from_fork+0x3f/0x70 [ 3902.466648] [<ffffffff8108fec0>] ? kthread_create_on_cpu+0x60/0x60 [ 3902.467953] Mem-Info: [ 3902.468537] active_anon:20817 inactive_anon:2098 isolated_anon:0 [ 3902.468537] active_file:145434 inactive_file:145453 isolated_file:0 [ 3902.468537] unevictable:0 dirty:20613 writeback:7248 unstable:0 [ 3902.468537] slab_reclaimable:86363 slab_unreclaimable:14905 [ 3902.468537] mapped:6670 shmem:2167 pagetables:1497 bounce:0 [ 3902.468537] free:5422 free_pcp:75 free_cma:0 [ 3902.476541] Node 0 DMA free:6904kB min:44kB low:52kB high:64kB active_anon:3268kB inactive_anon:200kB active_file:4kB inactive_file:4kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15988kB managed:15904kB mlocked:0kB dirty:0kB writeback:0kB mapped:36kB shmem:216kB slab_reclaimable:3708kB slab_unreclaimable:456kB kernel_stack:48kB pagetables:160kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no [ 3902.486494] lowmem_reserve[]: 0 1714 1714 1714 [ 3902.487659] Node 0 DMA32 free:13760kB min:5172kB low:6464kB high:7756kB active_anon:80000kB inactive_anon:8192kB active_file:581780kB inactive_file:581848kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:1758960kB mlocked:0kB dirty:82312kB writeback:29588kB mapped:26648kB shmem:8452kB slab_reclaimable:341744kB slab_unreclaimable:59496kB kernel_stack:3456kB pagetables:5828kB unstable:0kB bounce:0kB free_pcp:732kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:560 all_unreclaimable? no [ 3902.500438] lowmem_reserve[]: 0 0 0 0 [ 3902.502373] Node 0 DMA: 42*4kB (UME) 84*8kB (UM) 57*16kB (UM) 15*32kB (UM) 11*64kB (M) 9*128kB (UME) 1*256kB (M) 1*512kB (M) 2*1024kB (UM) 0*2048kB 0*4096kB = 6904kB [ 3902.507561] Node 0 DMA32: 3788*4kB (UME) 184*8kB (UME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 16624kB [ 3902.511236] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB [ 3902.513938] 292144 total pagecache pages [ 3902.515609] 0 pages in swap cache [ 3902.517139] Swap cache stats: add 0, delete 0, find 0/0 [ 3902.519153] Free swap = 0kB [ 3902.520587] Total swap = 0kB [ 3902.522095] 524157 pages RAM [ 3902.523511] 0 pages HighMem/MovableOnly [ 3902.525091] 80441 pages reserved [ 3902.526580] 0 pages hwpoisoned [ 3902.528169] Out of memory: Kill process 687 (firewalld) score 11 or sacrifice child [ 3902.531017] Killed process 687 (firewalld) total-vm:323600kB, anon-rss:17032kB, file-rss:4896kB, shmem-rss:0kB [ 5262.901161] smbd invoked oom-killer: order=2, oom_score_adj=0, gfp_mask=0x27000c0(GFP_KERNEL|GFP_NOTRACK|0x100000) [ 5262.903629] smbd cpuset=/ mems_allowed=0 [ 5262.904725] CPU: 2 PID: 3935 Comm: smbd Not tainted 4.4.0-rc6-next-20151222 #255 [ 5262.906401] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013 [ 5262.908679] 0000000000000000 00000000eaa24b41 ffff88007c37faf8 ffffffff81395bc3 [ 5262.910459] 0000000000000000 ffff88007c37fb98 ffffffff811babac 0000000000000206 [ 5262.912224] ffffffff81810470 ffff88007c37fb38 ffffffff810bce29 0000000000000206 [ 5262.914019] Call Trace: [ 5262.914839] [<ffffffff81395bc3>] dump_stack+0x4b/0x68 [ 5262.916118] [<ffffffff811babac>] dump_header+0x5b/0x3b0 [ 5262.917493] [<ffffffff810bce29>] ? trace_hardirqs_on_caller+0xf9/0x1c0 [ 5262.919131] [<ffffffff810bcefd>] ? trace_hardirqs_on+0xd/0x10 [ 5262.920690] [<ffffffff81142646>] oom_kill_process+0x366/0x540 [ 5262.922204] [<ffffffff81142a5f>] out_of_memory+0x1ef/0x5a0 [ 5262.923863] [<ffffffff81142b1d>] ? out_of_memory+0x2ad/0x5a0 [ 5262.925386] [<ffffffff8114836d>] __alloc_pages_nodemask+0xb9d/0xd90 [ 5262.927121] [<ffffffff8114871c>] alloc_kmem_pages_node+0x4c/0xc0 [ 5262.928738] [<ffffffff8106c451>] copy_process.part.31+0x131/0x1b40 [ 5262.930438] [<ffffffff8111c4da>] ? __audit_syscall_entry+0xaa/0xf0 [ 5262.932110] [<ffffffff8106e02b>] _do_fork+0xdb/0x5d0 [ 5262.933410] [<ffffffff8111c4da>] ? __audit_syscall_entry+0xaa/0xf0 [ 5262.935016] [<ffffffff810030c1>] ? do_audit_syscall_entry+0x61/0x70 [ 5262.936632] [<ffffffff81003254>] ? syscall_trace_enter_phase1+0x134/0x150 [ 5262.938383] [<ffffffff81003017>] ? trace_hardirqs_on_thunk+0x17/0x19 [ 5262.940024] [<ffffffff8106e5a4>] SyS_clone+0x14/0x20 [ 5262.941465] [<ffffffff816fc532>] entry_SYSCALL_64_fastpath+0x12/0x76 [ 5262.943137] Mem-Info: [ 5262.944068] active_anon:37901 inactive_anon:2095 isolated_anon:0 [ 5262.944068] active_file:134812 inactive_file:135474 isolated_file:0 [ 5262.944068] unevictable:0 dirty:257 writeback:0 unstable:0 [ 5262.944068] slab_reclaimable:90770 slab_unreclaimable:12759 [ 5262.944068] mapped:4223 shmem:2166 pagetables:1428 bounce:0 [ 5262.944068] free:3738 free_pcp:49 free_cma:0 [ 5262.953176] Node 0 DMA free:6904kB min:44kB low:52kB high:64kB active_anon:900kB inactive_anon:200kB active_file:4kB inactive_file:4kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15988kB managed:15904kB mlocked:0kB dirty:0kB writeback:0kB mapped:32kB shmem:216kB slab_reclaimable:5556kB slab_unreclaimable:712kB kernel_stack:48kB pagetables:152kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no [ 5262.963749] lowmem_reserve[]: 0 1714 1714 1714 [ 5262.965434] Node 0 DMA32 free:8048kB min:5172kB low:6464kB high:7756kB active_anon:150704kB inactive_anon:8180kB active_file:539244kB inactive_file:541892kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:1758960kB mlocked:0kB dirty:1028kB writeback:0kB mapped:16860kB shmem:8448kB slab_reclaimable:357524kB slab_unreclaimable:50324kB kernel_stack:3232kB pagetables:5560kB unstable:0kB bounce:0kB free_pcp:184kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:132 all_unreclaimable? no [ 5262.976879] lowmem_reserve[]: 0 0 0 0 [ 5262.978586] Node 0 DMA: 58*4kB (UME) 60*8kB (UME) 73*16kB (UME) 23*32kB (UME) 13*64kB (UME) 5*128kB (UM) 5*256kB (UME) 3*512kB (UE) 0*1024kB 0*2048kB 0*4096kB = 6904kB [ 5262.983496] Node 0 DMA32: 1987*4kB (UME) 14*8kB (ME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 8060kB [ 5262.987124] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB [ 5262.989532] 272459 total pagecache pages [ 5262.991203] 0 pages in swap cache [ 5262.992583] Swap cache stats: add 0, delete 0, find 0/0 [ 5262.994334] Free swap = 0kB [ 5262.995787] Total swap = 0kB [ 5262.997038] 524157 pages RAM [ 5262.998270] 0 pages HighMem/MovableOnly [ 5262.999683] 80441 pages reserved [ 5263.001153] 0 pages hwpoisoned [ 5263.002612] Out of memory: Kill process 26226 (genxref) score 54 or sacrifice child [ 5263.004648] Killed process 26226 (genxref) total-vm:130348kB, anon-rss:94680kB, file-rss:4756kB, shmem-rss:0kB [ 5269.764580] kthreadd invoked oom-killer: order=2, oom_score_adj=0, gfp_mask=0x27000c0(GFP_KERNEL|GFP_NOTRACK|0x100000) [ 5269.767289] kthreadd cpuset=/ mems_allowed=0 [ 5269.768904] CPU: 2 PID: 2 Comm: kthreadd Not tainted 4.4.0-rc6-next-20151222 #255 [ 5269.770956] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013 [ 5269.773754] 0000000000000000 000000009cc7eb67 ffff88007cc1faa0 ffffffff81395bc3 [ 5269.776088] 0000000000000000 ffff88007cc1fb40 ffffffff811babac 0000000000000206 [ 5269.778213] ffffffff81810470 ffff88007cc1fae0 ffffffff810bce29 0000000000000206 [ 5269.780497] Call Trace: [ 5269.781796] [<ffffffff81395bc3>] dump_stack+0x4b/0x68 [ 5269.783634] [<ffffffff811babac>] dump_header+0x5b/0x3b0 [ 5269.786116] [<ffffffff810bce29>] ? trace_hardirqs_on_caller+0xf9/0x1c0 [ 5269.788495] [<ffffffff810bcefd>] ? trace_hardirqs_on+0xd/0x10 [ 5269.790538] [<ffffffff81142646>] oom_kill_process+0x366/0x540 [ 5269.792755] [<ffffffff81142a5f>] out_of_memory+0x1ef/0x5a0 [ 5269.794784] [<ffffffff81142b1d>] ? out_of_memory+0x2ad/0x5a0 [ 5269.796848] [<ffffffff8114836d>] __alloc_pages_nodemask+0xb9d/0xd90 [ 5269.799038] [<ffffffff810bce00>] ? trace_hardirqs_on_caller+0xd0/0x1c0 [ 5269.801073] [<ffffffff8114871c>] alloc_kmem_pages_node+0x4c/0xc0 [ 5269.803186] [<ffffffff8106c451>] copy_process.part.31+0x131/0x1b40 [ 5269.805249] [<ffffffff8108f590>] ? kthread_create_on_node+0x230/0x230 [ 5269.807374] [<ffffffff8106e02b>] _do_fork+0xdb/0x5d0 [ 5269.809089] [<ffffffff81094a8a>] ? finish_task_switch+0x6a/0x2b0 [ 5269.811146] [<ffffffff8106e544>] kernel_thread+0x24/0x30 [ 5269.812944] [<ffffffff8109007c>] kthreadd+0x1bc/0x220 [ 5269.814698] [<ffffffff816fc89f>] ? ret_from_fork+0x3f/0x70 [ 5269.816330] [<ffffffff8108fec0>] ? kthread_create_on_cpu+0x60/0x60 [ 5269.818088] [<ffffffff816fc89f>] ret_from_fork+0x3f/0x70 [ 5269.819685] [<ffffffff8108fec0>] ? kthread_create_on_cpu+0x60/0x60 [ 5269.821399] Mem-Info: [ 5269.822430] active_anon:14280 inactive_anon:2095 isolated_anon:0 [ 5269.822430] active_file:134344 inactive_file:134515 isolated_file:0 [ 5269.822430] unevictable:0 dirty:2 writeback:0 unstable:0 [ 5269.822430] slab_reclaimable:96214 slab_unreclaimable:22185 [ 5269.822430] mapped:3512 shmem:2166 pagetables:1368 bounce:0 [ 5269.822430] free:12388 free_pcp:51 free_cma:0 [ 5269.831310] Node 0 DMA free:6892kB min:44kB low:52kB high:64kB active_anon:856kB inactive_anon:200kB active_file:4kB inactive_file:4kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15988kB managed:15904kB mlocked:0kB dirty:0kB writeback:0kB mapped:32kB shmem:216kB slab_reclaimable:5556kB slab_unreclaimable:768kB kernel_stack:48kB pagetables:152kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no [ 5269.840580] lowmem_reserve[]: 0 1714 1714 1714 [ 5269.842107] Node 0 DMA32 free:42660kB min:5172kB low:6464kB high:7756kB active_anon:56264kB inactive_anon:8180kB active_file:537372kB inactive_file:538056kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:1758960kB mlocked:0kB dirty:8kB writeback:0kB mapped:14020kB shmem:8448kB slab_reclaimable:379300kB slab_unreclaimable:87972kB kernel_stack:3232kB pagetables:5320kB unstable:0kB bounce:0kB free_pcp:204kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no [ 5269.852375] lowmem_reserve[]: 0 0 0 0 [ 5269.853784] Node 0 DMA: 67*4kB (ME) 60*8kB (UME) 72*16kB (ME) 22*32kB (ME) 13*64kB (UME) 5*128kB (UM) 5*256kB (UME) 3*512kB (UE) 0*1024kB 0*2048kB 0*4096kB = 6892kB [ 5269.858330] Node 0 DMA32: 10648*4kB (UME) 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 42592kB [ 5269.861551] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB [ 5269.863676] 271012 total pagecache pages [ 5269.865100] 0 pages in swap cache [ 5269.866366] Swap cache stats: add 0, delete 0, find 0/0 [ 5269.867996] Free swap = 0kB [ 5269.869363] Total swap = 0kB [ 5269.870593] 524157 pages RAM [ 5269.871857] 0 pages HighMem/MovableOnly [ 5269.873604] 80441 pages reserved [ 5269.874937] 0 pages hwpoisoned [ 5269.876207] Out of memory: Kill process 2710 (tuned) score 7 or sacrifice child [ 5269.878265] Killed process 2710 (tuned) total-vm:553052kB, anon-rss:10596kB, file-rss:2776kB, shmem-rss:0kB -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
|---|---|
| Date | 2015-12-28 13:10 +0100 |
| Message-ID | <qKEMH-1Ku-27@gated-at.bofh.it> |
| In reply to | #1297844 |
Tetsuo Handa wrote:
> I got OOM killers while running heavy disk I/O (extracting kernel source,
> running lxr's genxref command). (Environ: 4 CPUs / 2048MB RAM / no swap / XFS)
> Do you think these OOM killers reasonable? Too weak against fragmentation?
Well, current patch invokes OOM killers when more than 75% of memory is used
for file cache (active_file: + inactive_file:). I think this is a surprising
thing for administrators and we want to retry more harder (but not forever,
please).
Complete log is at http://I-love.SAKURA.ne.jp/tmp/serial-20151228.txt.xz .
----------
[ 277.863985] Node 0 DMA32 free:20128kB min:5564kB low:6952kB high:8344kB active_anon:108332kB inactive_anon:8252kB active_file:985160kB inactive_file:615436kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:2021100kB mlocked:0kB dirty:4kB writeback:0kB mapped:5904kB shmem:8524kB slab_reclaimable:52088kB slab_unreclaimable:59748kB kernel_stack:31280kB pagetables:55708kB unstable:0kB bounce:0kB free_pcp:1056kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 277.884512] Node 0 DMA32: 3438*4kB (UME) 791*8kB (UME) 3*16kB (UM) 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 20128kB
[ 291.331040] Node 0 DMA32 free:29500kB min:5564kB low:6952kB high:8344kB active_anon:126756kB inactive_anon:8252kB active_file:821500kB inactive_file:604016kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:2021100kB mlocked:0kB dirty:0kB writeback:0kB mapped:12684kB shmem:8524kB slab_reclaimable:56808kB slab_unreclaimable:99804kB kernel_stack:58448kB pagetables:92552kB unstable:0kB bounce:0kB free_pcp:2004kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 291.349097] Node 0 DMA32: 4221*4kB (UME) 1971*8kB (UME) 436*16kB (UME) 141*32kB (UME) 8*64kB (UM) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 44652kB
[ 302.897985] Node 0 DMA32 free:28240kB min:5564kB low:6952kB high:8344kB active_anon:79344kB inactive_anon:8248kB active_file:1016568kB inactive_file:604696kB unevictable:0kB isolated(anon):0kB isolated(file):120kB present:2080640kB managed:2021100kB mlocked:0kB dirty:80kB writeback:0kB mapped:13004kB shmem:8520kB slab_reclaimable:52076kB slab_unreclaimable:64064kB kernel_stack:35168kB pagetables:48552kB unstable:0kB bounce:0kB free_pcp:1384kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 302.916334] Node 0 DMA32: 4304*4kB (UM) 1181*8kB (UME) 59*16kB (UME) 7*32kB (ME) 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 27832kB
[ 311.014501] Node 0 DMA32 free:22820kB min:5564kB low:6952kB high:8344kB active_anon:56852kB inactive_anon:11976kB active_file:1142936kB inactive_file:582040kB unevictable:0kB isolated(anon):0kB isolated(file):116kB present:2080640kB managed:2021100kB mlocked:0kB dirty:160kB writeback:0kB mapped:10796kB shmem:16640kB slab_reclaimable:48608kB slab_unreclaimable:41912kB kernel_stack:16560kB pagetables:30876kB unstable:0kB bounce:0kB free_pcp:948kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:128 all_unreclaimable? no
[ 311.034251] Node 0 DMA32: 6*4kB (U) 2401*8kB (ME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 19232kB
[ 314.293371] Node 0 DMA32 free:15244kB min:5564kB low:6952kB high:8344kB active_anon:82496kB inactive_anon:11976kB active_file:1110984kB inactive_file:467400kB unevictable:0kB isolated(anon):0kB isolated(file):88kB present:2080640kB managed:2021100kB mlocked:0kB dirty:4kB writeback:0kB mapped:9440kB shmem:16640kB slab_reclaimable:53684kB slab_unreclaimable:72536kB kernel_stack:40048kB pagetables:67672kB unstable:0kB bounce:0kB free_pcp:1076kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:12 all_unreclaimable? no
[ 314.314336] Node 0 DMA32: 1180*4kB (UM) 1449*8kB (UME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 16312kB
[ 322.774181] Node 0 DMA32 free:19780kB min:5564kB low:6952kB high:8344kB active_anon:68264kB inactive_anon:17816kB active_file:1155724kB inactive_file:470216kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:2021100kB mlocked:0kB dirty:8kB writeback:0kB mapped:9744kB shmem:24708kB slab_reclaimable:52540kB slab_unreclaimable:63216kB kernel_stack:32464kB pagetables:51856kB unstable:0kB bounce:0kB free_pcp:1076kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 322.796256] Node 0 DMA32: 86*4kB (UME) 2474*8kB (UME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 20136kB
[ 330.804341] Node 0 DMA32 free:22076kB min:5564kB low:6952kB high:8344kB active_anon:47616kB inactive_anon:17816kB active_file:1063272kB inactive_file:685848kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:2021100kB mlocked:0kB dirty:216kB writeback:0kB mapped:9708kB shmem:24708kB slab_reclaimable:48536kB slab_unreclaimable:36844kB kernel_stack:12048kB pagetables:25992kB unstable:0kB bounce:0kB free_pcp:776kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 330.826190] Node 0 DMA32: 1637*4kB (UM) 1354*8kB (UME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 17380kB
[ 332.828224] Node 0 DMA32 free:15544kB min:5564kB low:6952kB high:8344kB active_anon:63184kB inactive_anon:17784kB active_file:1215752kB inactive_file:468872kB unevictable:0kB isolated(anon):0kB isolated(file):68kB present:2080640kB managed:2021100kB mlocked:0kB dirty:312kB writeback:0kB mapped:9116kB shmem:24708kB slab_reclaimable:49912kB slab_unreclaimable:50068kB kernel_stack:21600kB pagetables:42384kB unstable:0kB bounce:0kB free_pcp:1364kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 332.846805] Node 0 DMA32: 4108*4kB (UME) 897*8kB (ME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 23608kB
[ 341.054731] Node 0 DMA32 free:20512kB min:5564kB low:6952kB high:8344kB active_anon:76796kB inactive_anon:23792kB active_file:1053836kB inactive_file:618588kB unevictable:0kB isolated(anon):0kB isolated(file):96kB present:2080640kB managed:2021100kB mlocked:0kB dirty:1656kB writeback:0kB mapped:19768kB shmem:32784kB slab_reclaimable:49000kB slab_unreclaimable:47636kB kernel_stack:21664kB pagetables:37188kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 341.073722] Node 0 DMA32: 3309*4kB (UM) 1124*8kB (UM) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 22228kB
[ 360.075472] Node 0 DMA32 free:17856kB min:5564kB low:6952kB high:8344kB active_anon:117872kB inactive_anon:25588kB active_file:1022532kB inactive_file:466856kB unevictable:0kB isolated(anon):0kB isolated(file):116kB present:2080640kB managed:2021100kB mlocked:0kB dirty:420kB writeback:0kB mapped:25300kB shmem:40976kB slab_reclaimable:57804kB slab_unreclaimable:79416kB kernel_stack:46784kB pagetables:78044kB unstable:0kB bounce:0kB free_pcp:1100kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 360.093794] Node 0 DMA32: 2719*4kB (UM) 97*8kB (UM) 14*16kB (UM) 37*32kB (UME) 27*64kB (UME) 3*128kB (UM) 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 15172kB
[ 368.853099] Node 0 DMA32 free:22524kB min:5564kB low:6952kB high:8344kB active_anon:79156kB inactive_anon:24876kB active_file:872972kB inactive_file:738900kB unevictable:0kB isolated(anon):0kB isolated(file):96kB present:2080640kB managed:2021100kB mlocked:0kB dirty:0kB writeback:0kB mapped:25708kB shmem:40976kB slab_reclaimable:50820kB slab_unreclaimable:62880kB kernel_stack:32048kB pagetables:49656kB unstable:0kB bounce:0kB free_pcp:524kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 368.871173] Node 0 DMA32: 5042*4kB (UM) 248*8kB (UM) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 22152kB
[ 379.261759] Node 0 DMA32 free:15888kB min:5564kB low:6952kB high:8344kB active_anon:89928kB inactive_anon:23780kB active_file:1295512kB inactive_file:358284kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:2021100kB mlocked:0kB dirty:1608kB writeback:0kB mapped:25376kB shmem:40976kB slab_reclaimable:47972kB slab_unreclaimable:50848kB kernel_stack:22320kB pagetables:42360kB unstable:0kB bounce:0kB free_pcp:248kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 379.279344] Node 0 DMA32: 2994*4kB (ME) 503*8kB (UM) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 16000kB
[ 387.367409] Node 0 DMA32 free:15320kB min:5564kB low:6952kB high:8344kB active_anon:76364kB inactive_anon:28712kB active_file:1061180kB inactive_file:596956kB unevictable:0kB isolated(anon):0kB isolated(file):120kB present:2080640kB managed:2021100kB mlocked:0kB dirty:20kB writeback:0kB mapped:27700kB shmem:49168kB slab_reclaimable:51236kB slab_unreclaimable:51096kB kernel_stack:22912kB pagetables:40920kB unstable:0kB bounce:0kB free_pcp:700kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 387.385740] Node 0 DMA32: 3638*4kB (UM) 115*8kB (UM) 1*16kB (U) 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 15488kB
[ 391.207543] Node 0 DMA32 free:15224kB min:5564kB low:6952kB high:8344kB active_anon:115956kB inactive_anon:28392kB active_file:1117532kB inactive_file:359656kB unevictable:0kB isolated(anon):0kB isolated(file):116kB present:2080640kB managed:2021100kB mlocked:0kB dirty:0kB writeback:0kB mapped:29348kB shmem:49168kB slab_reclaimable:56028kB slab_unreclaimable:85168kB kernel_stack:48592kB pagetables:81620kB unstable:0kB bounce:0kB free_pcp:1124kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:356 all_unreclaimable? no
[ 391.228084] Node 0 DMA32: 3374*4kB (UME) 221*8kB (M) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 15264kB
[ 395.663881] Node 0 DMA32 free:12820kB min:5564kB low:6952kB high:8344kB active_anon:98924kB inactive_anon:27520kB active_file:1105780kB inactive_file:494760kB unevictable:0kB isolated(anon):4kB isolated(file):0kB present:2080640kB managed:2021100kB mlocked:0kB dirty:1412kB writeback:12kB mapped:29588kB shmem:49168kB slab_reclaimable:49836kB slab_unreclaimable:60524kB kernel_stack:32176kB pagetables:50356kB unstable:0kB bounce:0kB free_pcp:1500kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:388 all_unreclaimable? no
[ 395.683137] Node 0 DMA32: 3794*4kB (ME) 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 15176kB
[ 399.871655] Node 0 DMA32 free:18432kB min:5564kB low:6952kB high:8344kB active_anon:99156kB inactive_anon:26780kB active_file:1150532kB inactive_file:408872kB unevictable:0kB isolated(anon):68kB isolated(file):80kB present:2080640kB managed:2021100kB mlocked:0kB dirty:3492kB writeback:0kB mapped:30924kB shmem:49168kB slab_reclaimable:54236kB slab_unreclaimable:68184kB kernel_stack:37392kB pagetables:63708kB unstable:0kB bounce:0kB free_pcp:784kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 399.890082] Node 0 DMA32: 4155*4kB (UME) 200*8kB (ME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 18220kB
[ 408.447006] Node 0 DMA32 free:12684kB min:5564kB low:6952kB high:8344kB active_anon:74296kB inactive_anon:25960kB active_file:1086404kB inactive_file:605660kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:2021100kB mlocked:0kB dirty:264kB writeback:0kB mapped:30604kB shmem:49168kB slab_reclaimable:50200kB slab_unreclaimable:45212kB kernel_stack:19184kB pagetables:34500kB unstable:0kB bounce:0kB free_pcp:740kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 408.465169] Node 0 DMA32: 2804*4kB (ME) 203*8kB (UME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 12840kB
[ 416.426931] Node 0 DMA32 free:15396kB min:5564kB low:6952kB high:8344kB active_anon:98836kB inactive_anon:32120kB active_file:964808kB inactive_file:666224kB unevictable:0kB isolated(anon):0kB isolated(file):116kB present:2080640kB managed:2021100kB mlocked:0kB dirty:4kB writeback:0kB mapped:33628kB shmem:57332kB slab_reclaimable:51048kB slab_unreclaimable:51824kB kernel_stack:23328kB pagetables:41896kB unstable:0kB bounce:0kB free_pcp:988kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 416.447247] Node 0 DMA32: 5158*4kB (UME) 68*8kB (M) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 21176kB
[ 418.780159] Node 0 DMA32 free:8876kB min:5564kB low:6952kB high:8344kB active_anon:86544kB inactive_anon:31516kB active_file:965016kB inactive_file:654444kB unevictable:0kB isolated(anon):0kB isolated(file):116kB present:2080640kB managed:2021100kB mlocked:0kB dirty:4kB writeback:0kB mapped:8408kB shmem:57332kB slab_reclaimable:48856kB slab_unreclaimable:61116kB kernel_stack:30224kB pagetables:48636kB unstable:0kB bounce:0kB free_pcp:980kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:260 all_unreclaimable? no
[ 418.799643] Node 0 DMA32: 3093*4kB (UME) 1043*8kB (UME) 2*16kB (M) 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 20748kB
[ 428.087913] Node 0 DMA32 free:22760kB min:5564kB low:6952kB high:8344kB active_anon:94544kB inactive_anon:38936kB active_file:1013576kB inactive_file:564976kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080640kB managed:2021100kB mlocked:0kB dirty:0kB writeback:0kB mapped:36096kB shmem:65376kB slab_reclaimable:52196kB slab_unreclaimable:60576kB kernel_stack:29888kB pagetables:56364kB unstable:0kB bounce:0kB free_pcp:852kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 428.109005] Node 0 DMA32: 2943*4kB (UME) 458*8kB (UME) 20*16kB (UME) 11*32kB (UME) 11*64kB (ME) 4*128kB (UME) 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 17324kB
[ 439.014180] Node 0 DMA32 free:11232kB min:5564kB low:6952kB high:8344kB active_anon:82868kB inactive_anon:38872kB active_file:1189912kB inactive_file:439592kB unevictable:0kB isolated(anon):12kB isolated(file):40kB present:2080640kB managed:2021100kB mlocked:0kB dirty:0kB writeback:1152kB mapped:35948kB shmem:65376kB slab_reclaimable:51224kB slab_unreclaimable:56664kB kernel_stack:27696kB pagetables:43180kB unstable:0kB bounce:0kB free_pcp:380kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 439.032446] Node 0 DMA32: 2761*4kB (UM) 28*8kB (UM) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 11268kB
[ 441.731001] Node 0 DMA32 free:15056kB min:5564kB low:6952kB high:8344kB active_anon:90532kB inactive_anon:42716kB active_file:1204248kB inactive_file:377196kB unevictable:0kB isolated(anon):12kB isolated(file):116kB present:2080640kB managed:2021100kB mlocked:0kB dirty:4kB writeback:0kB mapped:5552kB shmem:73568kB slab_reclaimable:52956kB slab_unreclaimable:68304kB kernel_stack:39936kB pagetables:47472kB unstable:0kB bounce:0kB free_pcp:624kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 441.731018] Node 0 DMA32: 3130*4kB (UM) 338*8kB (UM) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 15224kB
[ 442.070851] Node 0 DMA32 free:8852kB min:5564kB low:6952kB high:8344kB active_anon:90412kB inactive_anon:42664kB active_file:1179304kB inactive_file:371316kB unevictable:0kB isolated(anon):108kB isolated(file):268kB present:2080640kB managed:2021100kB mlocked:0kB dirty:4kB writeback:0kB mapped:5544kB shmem:73568kB slab_reclaimable:55136kB slab_unreclaimable:80080kB kernel_stack:55456kB pagetables:52692kB unstable:0kB bounce:0kB free_pcp:312kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:348 all_unreclaimable? no
[ 442.070867] Node 0 DMA32: 590*4kB (ME) 827*8kB (ME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 8976kB
[ 442.245192] Node 0 DMA32 free:10832kB min:5564kB low:6952kB high:8344kB active_anon:97756kB inactive_anon:42664kB active_file:1082048kB inactive_file:417012kB unevictable:0kB isolated(anon):108kB isolated(file):268kB present:2080640kB managed:2021100kB mlocked:0kB dirty:4kB writeback:0kB mapped:5248kB shmem:73568kB slab_reclaimable:62816kB slab_unreclaimable:88964kB kernel_stack:61408kB pagetables:62908kB unstable:0kB bounce:0kB free_pcp:696kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 442.245208] Node 0 DMA32: 1902*4kB (UME) 410*8kB (UME) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 10888kB
----------
Since I cannot establish workload that caused December 24's natural OOM
killers, I used the following stressor for generating similar situation.
The fileio.c fills up all memory with file cache and tries to keep them
on memory. The fork.c is flood of order-2 allocation generator because
December 24's OOM killers were triggered by copy_process() which involves
order-2 allocation request.
---------- fileio.c start ----------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
int main(int argc, char *argv[])
{
int i;
static char buffer[4096];
signal(SIGCHLD, SIG_IGN);
for (i = 0; i < 2; i++) {
int fd;
int j;
snprintf(buffer, sizeof(buffer), "/tmp/file.%u", i);
fd = open(buffer, O_RDWR | O_CREAT, 0600);
memset(buffer, 0, sizeof(buffer));
for (j = 0; j < 1048576 * 1000 / 4096; j++) /* 1000 is MemTotal / 2 */
write(fd, buffer, sizeof(buffer));
close(fd);
}
for (i = 0; i < 2; i++) {
if (fork() == 0) {
int fd;
snprintf(buffer, sizeof(buffer), "/tmp/file.%u", i);
fd = open(buffer, O_RDWR);
memset(buffer, 0, sizeof(buffer));
while (fd != EOF) {
lseek(fd, 0, SEEK_SET);
while (read(fd, buffer, sizeof(buffer)) == sizeof(buffer));
}
_exit(0);
}
}
if (fork() == 0) {
execl("./fork", "./fork", NULL);
_exit(1);
}
if (fork() == 0) {
sleep(1);
execl("./fork", "./fork", NULL);
_exit(1);
}
while (1)
system("pidof fork | wc");
return 0;
}
---------- fileio.c end ----------
---------- fork.c start ----------
#include <unistd.h>
#include <signal.h>
int main(int argc, char *argv[])
{
int i;
signal(SIGCHLD, SIG_IGN);
while (1) {
sleep(5);
for (i = 0; i < 2000; i++) {
if (fork() == 0) {
sleep(3);
_exit(0);
}
}
}
}
---------- fork.c end ----------
This reproducer also showed that once the OOM killer is invoked,
subsequent OOM killers tend to occur shortly because file cache
do not decrease.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
|---|---|
| Date | 2015-12-28 15:20 +0100 |
| Message-ID | <qKGOu-3bZ-7@gated-at.bofh.it> |
| In reply to | #1298618 |
Tetsuo Handa wrote: > Tetsuo Handa wrote: > > I got OOM killers while running heavy disk I/O (extracting kernel source, > > running lxr's genxref command). (Environ: 4 CPUs / 2048MB RAM / no swap / XFS) > > Do you think these OOM killers reasonable? Too weak against fragmentation? > > Since I cannot establish workload that caused December 24's natural OOM > killers, I used the following stressor for generating similar situation. > I came to feel that I am observing a different problem which is currently hidden behind the "too small to fail" memory-allocation rule. That is, tasks requesting order > 0 pages are continuously losing the competition when tasks requesting order = 0 pages dominate, for reclaimed pages are stolen by tasks requesting order = 0 pages before reclaimed pages are combined to order > 0 pages (or maybe order > 0 pages are immediately split into order = 0 pages due to tasks requesting order = 0 pages). Currently, order <= PAGE_ALLOC_COSTLY_ORDER allocations implicitly retry unless chosen by the OOM killer. Therefore, even if tasks requesting order = 2 pages lost the competition when there are tasks requesting order = 0 pages, the order = 2 allocation request is implicitly retried and therefore the OOM killer is not invoked (though there is a problem that tasks requesting order > 0 allocation will stall as long as tasks requesting order = 0 pages dominate). But this patchset introduced a limit of 16 retries. Thus, if tasks requesting order = 2 pages lost the competition for 16 times due to tasks requesting order = 0 pages, tasks requesting order = 2 pages invoke the OOM killer. To avoid the OOM killer, we need to make sure that pages reclaimed for order > 0 allocations will not be stolen by tasks requesting order = 0 allocations. Is my feeling plausible? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2015-12-29 17:40 +0100 |
| Message-ID | <qL5tw-2Yw-3@gated-at.bofh.it> |
| In reply to | #1298618 |
On Mon 28-12-15 21:08:56, Tetsuo Handa wrote: > Tetsuo Handa wrote: > > I got OOM killers while running heavy disk I/O (extracting kernel source, > > running lxr's genxref command). (Environ: 4 CPUs / 2048MB RAM / no swap / XFS) > > Do you think these OOM killers reasonable? Too weak against fragmentation? > > Well, current patch invokes OOM killers when more than 75% of memory is used > for file cache (active_file: + inactive_file:). I think this is a surprising > thing for administrators and we want to retry more harder (but not forever, > please). Here again, it would be good to see what is the comparision between the original and the new behavior. 75% of a page cache is certainly unexpected but those pages might be pinned for other reasons and so unreclaimable and basically IO bound. This is hard to optimize for without causing any undesirable side effects for other loads. I will have a look at the oom reports later but having a comparision would be a great start. Thanks! -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
|---|---|
| Date | 2015-12-30 16:10 +0100 |
| Message-ID | <qLqxX-8eS-1@gated-at.bofh.it> |
| In reply to | #1299048 |
Michal Hocko wrote: > On Mon 28-12-15 21:08:56, Tetsuo Handa wrote: > > Tetsuo Handa wrote: > > > I got OOM killers while running heavy disk I/O (extracting kernel source, > > > running lxr's genxref command). (Environ: 4 CPUs / 2048MB RAM / no swap / XFS) > > > Do you think these OOM killers reasonable? Too weak against fragmentation? > > > > Well, current patch invokes OOM killers when more than 75% of memory is used > > for file cache (active_file: + inactive_file:). I think this is a surprising > > thing for administrators and we want to retry more harder (but not forever, > > please). > > Here again, it would be good to see what is the comparision between > the original and the new behavior. 75% of a page cache is certainly > unexpected but those pages might be pinned for other reasons and so > unreclaimable and basically IO bound. This is hard to optimize for > without causing any undesirable side effects for other loads. I will > have a look at the oom reports later but having a comparision would be > a great start. Prior to "mm, oom: rework oom detection" patch (the original), this stressor never invoked the OOM killer. After this patch (the new), this stressor easily invokes the OOM killer. Both the original and the new case, active_file: + inactive_file: occupies nearly 75%. I think we lost invisible retry logic for order > 0 allocation requests. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2015-12-29 17:30 +0100 |
| Message-ID | <qL5jQ-2Vk-7@gated-at.bofh.it> |
| In reply to | #1297844 |
On Thu 24-12-15 21:41:19, Tetsuo Handa wrote: > I got OOM killers while running heavy disk I/O (extracting kernel source, > running lxr's genxref command). (Environ: 4 CPUs / 2048MB RAM / no swap / XFS) > Do you think these OOM killers reasonable? Too weak against fragmentation? I will have a look at the oom report more closely early next week (I am still in holiday mode) but it would be good to compare how the same load behaves with the original implementation. It would be also interesting to see how stable are the results (is there any variability in multiple runs?). Thanks! -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web