From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: linux-mm@kvack.org
Subject: [RFC PATCH 0/5] mm: Patches for mitigating memory allocation stalls.
Date: Sun, 23 Nov 2014 13:49:27 +0900 [thread overview]
Message-ID: <201411231349.CAG78628.VFQFOtOSFJMOLH@I-love.SAKURA.ne.jp> (raw)
This patchset serves for two purposes.
(a) Mitigate one of phenomena
"Regarding many of Linux kernel versions (from unknown till now), any
local user can give a certain type of memory pressure which causes
__alloc_pages_nodemask() to keep trying to reclaim memory for
presumably forever. As a consequence, such user can disturb any users'
activities by keeping the system stalled with 0% or 100% CPU usage.
On systems where XFS is used, SysRq-f (forced OOM killer) may become
unresponsive because kernel worker thread which is supposed to process
SysRq-f request is blocked by previous request's GFP_WAIT allocation."
which is triggered by a vulnerability which exists since (if I didn't
miss something) Linux 2.0 (18 years ago).
I reported this vulnerability last year and a CVE number was assigned,
but no progress has been made. If a malicious local user notices a
patchset that mitigates/fixes this vulnerability, the user is free to
attack existing Linux systems. Therefore, I propose this patchset before
any patchset that mitigates/fixes this vulnerability is proposed.
(b) Help debugging memory allocation stall problems which are not caused
by malicious attacks. Since I'm providing technical support service for
troubleshooting RHEL systems, I sometimes encounter cases where memory
allocation is suspicious. But SysRq or hung check timer does not report
how long the thread stalled for memory allocation. Therefore, I propose
this patchset for reporting and responding memory allocation stalls.
This patchset does the following things.
[PATCH 1/5] mm: Introduce OOM kill timeout.
Introduce timeout for TIF_MEMDIE threads in case they cannot be
terminated immediately for some reason.
[PATCH 2/5] mm: Kill shrinker's global semaphore.
Don't respond with "try again" when we need to call out_of_memory().
[PATCH 3/5] mm: Remember ongoing memory allocation status.
Remember the starting time of ongoing memory allocation, and let
thread dump print how long ongoing memory allocation is stalled.
[PATCH 4/5] mm: Drop __GFP_WAIT flag when allocating from shrinker functions.
Avoid potential deadlock or kernel stack overflow by calling shrinker
functions recursively.
[PATCH 5/5] mm: Insert some delay if ongoing memory allocation stalls.
Introduce a small sleep for saving CPU when memory allocation is taking
too long.
This patchset is meant for ease of backporting because fixing the root cause
requires fundamental changes which may prevent any Linux systems from working
unless carefully implemented and appropriately configured.
drivers/staging/android/lowmemorykiller.c | 2
include/linux/mm.h | 2
include/linux/sched.h | 5 +
include/linux/shrinker.h | 4 +
kernel/sched/core.c | 17 ++++++
mm/memcontrol.c | 2
mm/oom_kill.c | 35 ++++++++++++-
mm/page_alloc.c | 68 +++++++++++++++++++++++++-
mm/vmscan.c | 78 +++++++++++++++++++++---------
9 files changed, 184 insertions(+), 29 deletions(-)
Regards.
--
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 reply other threads:[~2014-11-23 4:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-23 4:49 Tetsuo Handa [this message]
2014-11-23 4:50 ` [PATCH 1/5] mm: Introduce OOM kill timeout Tetsuo Handa
2014-11-24 16:50 ` Michal Hocko
2014-11-24 22:29 ` David Rientjes
2014-11-25 10:38 ` Michal Hocko
2014-11-25 12:54 ` Tetsuo Handa
2014-11-25 13:45 ` Michal Hocko
2014-11-26 11:58 ` Tetsuo Handa
2014-11-26 18:43 ` Michal Hocko
2014-11-27 14:49 ` Tetsuo Handa
2014-11-28 16:17 ` Michal Hocko
2014-11-23 4:50 ` [PATCH 2/5] mm: Kill shrinker's global semaphore Tetsuo Handa
2014-11-24 16:55 ` Michal Hocko
2014-11-23 4:51 ` [PATCH 3/5] mm: Remember ongoing memory allocation status Tetsuo Handa
2014-11-24 17:01 ` Michal Hocko
2014-11-23 4:52 ` [PATCH 4/5] mm: Drop __GFP_WAIT flag when allocating from shrinker functions Tetsuo Handa
2014-11-24 17:14 ` Michal Hocko
2014-11-23 4:53 ` [PATCH 5/5] mm: Insert some delay if ongoing memory allocation stalls Tetsuo Handa
2014-11-24 17:19 ` Michal Hocko
2014-11-24 17:25 ` [RFC PATCH 0/5] mm: Patches for mitigating " 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=201411231349.CAG78628.VFQFOtOSFJMOLH@I-love.SAKURA.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=linux-mm@kvack.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