From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: mhocko@kernel.org
Cc: akpm@linux-foundation.org, rientjes@google.com,
linux-mm@kvack.org, oleg@redhat.com,
penguin-kernel@I-love.SAKURA.ne.jp
Subject: Re: [PATCH v3] mm,oom: speed up select_bad_process() loop.
Date: Wed, 18 May 2016 23:44:29 +0900 [thread overview]
Message-ID: <201605182344.IBJ06800.HLJMStFFFQVOOO@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <201605182230.IDC73435.MVSOHLFOQFOJtF@I-love.SAKURA.ne.jp>
Michal Hocko wrote:
> On Wed 18-05-16 22:30:14, Tetsuo Handa wrote:
> > Even if you call p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN case a bug,
> > (p->flags & PF_KTHREAD) || is_global_init(p) case is still possible.
>
> I couldn't care less about such a case to be honest, and that is not a
> reason the cripple the code for such an insanity. There simply doesn't
> make any sense to share init's mm with a different task.
The global init called vfork(), and the child tried to call execve() with
large argv/envp array, and the child got OOM-killed is possible.
> OK, this looks correct. Strictly speaking the patch is missing any note
> on _why_ this is needed or an improvement. I would add something like
> the following:
> "
> Although the original code was correct it was quite inefficient because
> each thread group was scanned num_threads times which can be a lot
> especially with processes with many threads. Even though the OOM is
> extremely cold path it is always good to be as effective as possible
> when we are inside rcu_read_lock() - aka unpreemptible context.
> "
rcu_read_lock() is not always unpreemptible context. rcu_read_lock() says:
In non-preemptible RCU implementations (TREE_RCU and TINY_RCU),
it is illegal to block while in an RCU read-side critical section.
In preemptible RCU implementations (PREEMPT_RCU) in CONFIG_PREEMPT
kernel builds, RCU read-side critical sections may be preempted,
but explicit blocking is illegal. Finally, in preemptible RCU
implementations in real-time (with -rt patchset) kernel builds, RCU
read-side critical sections may be preempted and they may also block, but
only when acquiring spinlocks that are subject to priority inheritance.
We will need preempt_disable() if we want to make out_of_memory() return
as fast as possible.
>
> > Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> > Cc: David Rientjes <rientjes@google.com>
> > Cc: Oleg Nesterov <oleg@redhat.com>
>
> Acked-by: Michal Hocko <mhocko@suse.com>
Thank you.
--
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:[~2016-05-18 14:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-18 12:20 [PATCH v2] " Tetsuo Handa
2016-05-18 12:51 ` Michal Hocko
2016-05-18 13:30 ` [PATCH v3] " Tetsuo Handa
2016-05-18 14:15 ` Michal Hocko
2016-05-18 21:09 ` Andrew Morton
2016-05-19 6:53 ` Michal Hocko
2016-05-19 7:17 ` Michal Hocko
2016-05-19 8:17 ` Michal Hocko
2016-05-20 1:50 ` Oleg Nesterov
2016-05-20 2:13 ` Oleg Nesterov
2016-05-20 6:42 ` Michal Hocko
2016-05-20 22:04 ` Oleg Nesterov
2016-05-18 14:44 ` Tetsuo Handa [this message]
2016-05-20 7:50 ` Michal Hocko
2016-05-20 11:51 ` Tetsuo Handa
2016-05-20 12:09 ` Michal Hocko
2016-05-20 13:41 ` Tetsuo Handa
2016-05-20 13:44 ` Tetsuo Handa
2016-05-20 15:23 ` Michal Hocko
2016-05-20 15:56 ` Tetsuo Handa
2016-05-23 7:55 ` Michal Hocko
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=201605182344.IBJ06800.HLJMStFFFQVOOO@I-love.SAKURA.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=oleg@redhat.com \
--cc=rientjes@google.com \
/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