From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: mhocko@kernel.org
Cc: htejun@gmail.com, cl@linux.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
rientjes@google.com, oleg@redhat.com, kwalker@redhat.com,
akpm@linux-foundation.org, hannes@cmpxchg.org,
vdavydov@parallels.com, skozina@redhat.com, mgorman@suse.de,
riel@redhat.com
Subject: Re: [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks
Date: Tue, 3 Nov 2015 11:32:06 +0900 [thread overview]
Message-ID: <201511031132.GBB09374.JQFOVSFLOtHFMO@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <20151102192053.GC9553@mtj.duckdns.org>
Tejun Heo wrote:
> If
> the possibility of sysrq getting stuck behind concurrency management
> is an issue, queueing them on an unbound or highpri workqueue should
> be good enough.
Regarding SysRq-f, we could do like below. Though I think that converting
the OOM killer into a dedicated kernel thread would allow more things to do
(e.g. Oleg's memory zapping code, my timeout based next victim selection).
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 5381a72..46b951aa 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -47,6 +47,7 @@
#include <linux/syscalls.h>
#include <linux/of.h>
#include <linux/rcupdate.h>
+#include <linux/kthread.h>
#include <asm/ptrace.h>
#include <asm/irq_regs.h>
@@ -351,27 +352,35 @@ static struct sysrq_key_op sysrq_term_op = {
.enable_mask = SYSRQ_ENABLE_SIGNAL,
};
-static void moom_callback(struct work_struct *ignored)
+static DECLARE_WAIT_QUEUE_HEAD(moom_wait);
+
+static int moom_callback(void *unused)
{
const gfp_t gfp_mask = GFP_KERNEL;
- struct oom_control oc = {
- .zonelist = node_zonelist(first_memory_node, gfp_mask),
- .nodemask = NULL,
- .gfp_mask = gfp_mask,
- .order = -1,
- };
-
- mutex_lock(&oom_lock);
- if (!out_of_memory(&oc))
- pr_info("OOM request ignored because killer is disabled\n");
- mutex_unlock(&oom_lock);
+ DEFINE_WAIT(wait);
+
+ while (1) {
+ struct oom_control oc = {
+ .zonelist = node_zonelist(first_memory_node, gfp_mask),
+ .nodemask = NULL,
+ .gfp_mask = gfp_mask,
+ .order = -1,
+ };
+
+ prepare_to_wait(&moom_wait, &wait, TASK_INTERRUPTIBLE);
+ schedule();
+ finish_wait(&moom_wait, &wait);
+ mutex_lock(&oom_lock);
+ if (!out_of_memory(&oc))
+ pr_info("OOM request ignored because killer is disabled\n");
+ mutex_unlock(&oom_lock);
+ }
+ return 0;
}
-static DECLARE_WORK(moom_work, moom_callback);
-
static void sysrq_handle_moom(int key)
{
- schedule_work(&moom_work);
+ wake_up(&moom_wait);
}
static struct sysrq_key_op sysrq_moom_op = {
.handler = sysrq_handle_moom,
@@ -1116,6 +1125,9 @@ static inline void sysrq_init_procfs(void)
static int __init sysrq_init(void)
{
+ struct task_struct *task = kthread_run(moom_callback, NULL,
+ "manual_oom");
+ BUG_ON(IS_ERR(task));
sysrq_init_procfs();
if (sysrq_on())
--
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-11-03 2:32 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-21 12:26 Tetsuo Handa
2015-10-21 13:03 ` Michal Hocko
2015-10-21 14:22 ` Christoph Lameter
2015-10-21 14:33 ` Michal Hocko
2015-10-21 14:49 ` Christoph Lameter
2015-10-21 14:55 ` Michal Hocko
2015-10-21 15:39 ` Tetsuo Handa
2015-10-21 17:16 ` Christoph Lameter
2015-10-22 11:37 ` Tetsuo Handa
2015-10-22 13:39 ` Christoph Lameter
2015-10-22 14:09 ` Tejun Heo
2015-10-22 14:21 ` Tejun Heo
2015-10-22 14:23 ` Christoph Lameter
2015-10-22 14:24 ` Tejun Heo
2015-10-22 14:25 ` Christoph Lameter
2015-10-22 14:33 ` Tejun Heo
2015-10-22 14:41 ` Christoph Lameter
2015-10-22 15:14 ` Tejun Heo
2015-10-23 4:26 ` Tejun Heo
2015-11-02 15:01 ` Michal Hocko
2015-11-02 19:20 ` Tejun Heo
2015-11-03 2:32 ` Tetsuo Handa [this message]
2015-11-03 19:43 ` Tejun Heo
2015-11-05 14:59 ` Tetsuo Handa
2015-11-05 17:45 ` Christoph Lameter
2015-11-06 0:16 ` Tejun Heo
2015-11-11 15:44 ` Michal Hocko
2015-11-11 16:03 ` Michal Hocko
2015-10-22 14:22 ` Christoph Lameter
2015-10-22 15:06 ` Michal Hocko
2015-10-22 15:15 ` Tejun Heo
2015-10-22 15:33 ` Christoph Lameter
2015-10-23 8:37 ` Michal Hocko
2015-10-23 11:43 ` Make vmstat deferrable again (was Re: [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks) Christoph Lameter
2015-10-23 12:07 ` Sergey Senozhatsky
2015-10-23 14:12 ` Christoph Lameter
2015-10-23 14:49 ` Sergey Senozhatsky
2015-10-23 16:10 ` Christoph Lameter
2015-10-22 15:35 ` [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks Michal Hocko
2015-10-22 15:37 ` Tejun Heo
2015-10-22 15:49 ` Michal Hocko
2015-10-22 18:42 ` Tejun Heo
2015-10-22 21:42 ` [PATCH] mm,vmscan: Use accurate values for zone_reclaimable()checks Tetsuo Handa
2015-10-22 22:47 ` Tejun Heo
2015-10-23 8:36 ` Michal Hocko
2015-10-23 10:37 ` Tejun Heo
2015-10-23 8:33 ` [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks Michal Hocko
2015-10-23 10:36 ` Tejun Heo
2015-10-23 11:11 ` Michal Hocko
2015-10-23 12:25 ` Tetsuo Handa
2015-10-23 18:23 ` Tejun Heo
2015-10-25 10:52 ` Tetsuo Handa
2015-10-25 22:47 ` Tejun Heo
2015-10-27 9:22 ` Michal Hocko
2015-10-27 10:55 ` Tejun Heo
2015-10-27 12:07 ` Michal Hocko
2015-10-23 18:21 ` Tejun Heo
2015-10-27 9:16 ` Michal Hocko
2015-10-27 10:52 ` Tejun Heo
2015-10-27 11:07 ` [PATCH] mm,vmscan: Use accurate values for zone_reclaimable()checks Tetsuo Handa
2015-10-27 11:30 ` Tejun Heo
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=201511031132.GBB09374.JQFOVSFLOtHFMO@I-love.SAKURA.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=hannes@cmpxchg.org \
--cc=htejun@gmail.com \
--cc=kwalker@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=oleg@redhat.com \
--cc=riel@redhat.com \
--cc=rientjes@google.com \
--cc=skozina@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=vdavydov@parallels.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