lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20091102162837.405783f3.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Mon, 2 Nov 2009 16:28:37 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"kosaki.motohiro@...fujitsu.com" <kosaki.motohiro@...fujitsu.com>,
	aarcange@...hat.com, akpm@...ux-foundation.org,
	minchan.kim@...il.com, rientjes@...gle.com, vedran.furac@...il.com,
	"hugh.dickins@...cali.co.uk" <hugh.dickins@...cali.co.uk>
Subject: [RFC][-mm][PATCH 5/6] oom-killer: check last total_vm expansion

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...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@...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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ