From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: mhocko@suse.cz, linux-mm@kvack.org
Cc: rientjes@google.com, hannes@cmpxchg.org, tj@kernel.org,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC -v2] panic_on_oom_timeout
Date: Wed, 17 Jun 2015 21:31:21 +0900 [thread overview]
Message-ID: <201506172131.EFE12444.JMLFOSVOHFOtFQ@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <20150617121104.GD25056@dhcp22.suse.cz>
Michal Hocko wrote:
> Hi,
> I was thinking about this and I am more and more convinced that we
> shouldn't care about panic_on_oom=2 configuration for now and go with
> the simplest solution first. I have revisited my original patch and
> replaced delayed work by a timer based on the feedback from Tetsuo.
>
To me, obsolating panic_on_oom > 0 sounds cleaner.
> I think we can rely on timers. A downside would be that we cannot dump
> the full OOM report from the IRQ context because we rely on task_lock
> which is not IRQ safe. But I do not think we really need it. An OOM
> report will be in the log already most of the time and show_mem will
> tell us the current memory situation.
>
> What do you think?
We can rely on timers, but we can't rely on global timer.
> + if (sysctl_panic_on_oom_timeout) {
> + if (sysctl_panic_on_oom > 1) {
> + pr_warn("panic_on_oom_timeout is ignored for panic_on_oom=2\n");
> + } else {
> + /*
> + * Only schedule the delayed panic_on_oom when this is
> + * the first OOM triggered. oom_lock will protect us
> + * from races
> + */
> + if (atomic_read(&oom_victims))
> + return;
> +
> + mod_timer(&panic_on_oom_timer,
> + jiffies + (sysctl_panic_on_oom_timeout * HZ));
> + return;
> + }
> + }
Since this version uses global panic_on_oom_timer, you cannot handle
OOM race like below.
(1) p1 in memcg1 calls out_of_memory().
(2) 5 seconds of timeout is started by p1.
(3) p1 takes 3 seconds for some reason.
(4) p2 in memcg2 calls out_of_memory().
(5) p1 calls unmark_oom_victim() but timer continues.
(6) p2 takes 2 seconds for some reason.
(7) 5 seconds of timeout expires despite individual delay was less than
5 seconds.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-06-17 12:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-09 17:03 [RFC] panic_on_oom_timeout Michal Hocko
2015-06-10 12:20 ` Tetsuo Handa
2015-06-10 14:28 ` Michal Hocko
2015-06-10 15:56 ` Michal Hocko
2015-06-12 15:23 ` Tetsuo Handa
2015-06-15 12:45 ` Michal Hocko
2015-06-16 13:14 ` Tetsuo Handa
2015-06-16 13:46 ` Michal Hocko
2015-06-17 12:16 ` Tetsuo Handa
2015-06-17 12:36 ` Michal Hocko
2015-06-11 13:12 ` Tetsuo Handa
2015-06-11 14:18 ` Michal Hocko
2015-06-11 14:45 ` Tetsuo Handa
2015-06-11 15:38 ` Michal Hocko
2015-06-17 12:11 ` [RFC -v2] panic_on_oom_timeout Michal Hocko
2015-06-17 12:31 ` Tetsuo Handa [this message]
2015-06-17 12:51 ` Michal Hocko
2015-06-17 13:24 ` Michal Hocko
2015-07-29 11:55 ` Michal Hocko
2015-07-29 13:20 ` Tetsuo Handa
2015-06-17 13:59 ` Tetsuo Handa
2015-06-17 15:41 ` Michal Hocko
2015-06-19 11:30 ` Tetsuo Handa
2015-06-19 15:36 ` Michal Hocko
2015-06-19 18:54 ` Tetsuo Handa
2015-06-20 7:57 ` Tetsuo Handa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201506172131.EFE12444.JMLFOSVOHFOtFQ@I-love.SAKURA.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=rientjes@google.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox