linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"kosaki.motohiro@jp.fujitsu.com" <kosaki.motohiro@jp.fujitsu.com>,
	aarcange@redhat.com, akpm@linux-foundation.org,
	minchan.kim@gmail.com, rientjes@google.com,
	vedran.furac@gmail.com,
	"hugh.dickins@tiscali.co.uk" <hugh.dickins@tiscali.co.uk>
Subject: [RFC][-mm][PATCH 5/6] oom-killer: check last total_vm expansion
Date: Mon, 2 Nov 2009 16:28:37 +0900	[thread overview]
Message-ID: <20091102162837.405783f3.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20091102162244.9425e49b.kamezawa.hiroyu@jp.fujitsu.com>

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

At considering oom-kill algorithm, we can't avoid to take runtime
into account. But this can adds too big bonus to slow-memory-leaker.
For adding penalty to slow-memory-leaker, we record jiffies of
the last mm->hiwater_vm expansion. That catches processes which leak
memory periodically.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 include/linux/mm_types.h |    2 ++
 include/linux/sched.h    |    4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Index: mmotm-2.6.32-Nov2/include/linux/mm_types.h
===================================================================
--- mmotm-2.6.32-Nov2.orig/include/linux/mm_types.h
+++ mmotm-2.6.32-Nov2/include/linux/mm_types.h
@@ -291,6 +291,8 @@ struct mm_struct {
 #endif
 	/* For OOM, fork-bomb detector */
 	unsigned long bomb_score;
+	/* set to jiffies at total_vm is finally expanded (see sched.h) */
+	unsigned long last_vm_expansion;
 };
 
 /* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
Index: mmotm-2.6.32-Nov2/include/linux/sched.h
===================================================================
--- mmotm-2.6.32-Nov2.orig/include/linux/sched.h
+++ mmotm-2.6.32-Nov2/include/linux/sched.h
@@ -422,8 +422,10 @@ extern void arch_unmap_area_topdown(stru
 		(mm)->hiwater_rss = _rss;		\
 } while (0)
 #define update_hiwater_vm(mm)	do {			\
-	if ((mm)->hiwater_vm < (mm)->total_vm)		\
+	if ((mm)->hiwater_vm < (mm)->total_vm) {	\
 		(mm)->hiwater_vm = (mm)->total_vm;	\
+		(mm)->last_vm_expansion = jiffies;	\
+	}\
 } while (0)
 
 static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)

--
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>

  parent reply	other threads:[~2009-11-02  7:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-02  7:22 [RFC][-mm][PATCH 0/6] oom-killer: total renewal KAMEZAWA Hiroyuki
2009-11-02  7:24 ` [RFC][-mm][PATCH 1/6] oom-killer: updates for classification of OOM KAMEZAWA Hiroyuki
2009-11-02 17:05   ` Christoph Lameter
2009-11-02 23:02     ` KAMEZAWA Hiroyuki
2009-11-03 20:18   ` David Rientjes
2009-11-04  0:01     ` KAMEZAWA Hiroyuki
2009-11-02  7:25 ` [RFC][-mm][PATCH 2/6] oom-killer: count swap usage per process KAMEZAWA Hiroyuki
2009-11-02 17:07   ` Christoph Lameter
2009-11-02 23:03     ` KAMEZAWA Hiroyuki
2009-11-03 19:47   ` David Rientjes
2009-11-04  0:02     ` KAMEZAWA Hiroyuki
2009-11-02  7:26 ` [RFC][-mm][PATCH 3/6] oom-killer: count lowmem rss KAMEZAWA Hiroyuki
2009-11-02 17:09   ` Christoph Lameter
2009-11-02 23:11     ` KAMEZAWA Hiroyuki
2009-11-03 20:24   ` David Rientjes
2009-11-04  0:22     ` KAMEZAWA Hiroyuki
2009-11-02  7:27 ` [RFC][-mm][PATCH 4/6] oom-killer: fork bomb detector KAMEZAWA Hiroyuki
2009-11-02  8:39   ` KAMEZAWA Hiroyuki
2009-11-02  7:28 ` KAMEZAWA Hiroyuki [this message]
2009-11-03 20:29   ` [RFC][-mm][PATCH 5/6] oom-killer: check last total_vm expansion David Rientjes
2009-11-04  0:25     ` KAMEZAWA Hiroyuki
2009-11-02  7:30 ` [RFC][-mm][PATCH 6/6] oom-killer: rewrite badness KAMEZAWA Hiroyuki
2009-11-02 15:04 ` [RFC][-mm][PATCH 0/6] oom-killer: total renewal Minchan Kim
2009-11-02 15:44   ` KAMEZAWA Hiroyuki
2009-11-03 20:34 ` David Rientjes
2009-11-03 23:56   ` KAMEZAWA Hiroyuki

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=20091102162837.405783f3.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=rientjes@google.com \
    --cc=vedran.furac@gmail.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