lkml.org 
[lkml]   [2009]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC][-mm][PATCH 5/6] oom-killer: check last total_vm expansion
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)


\
 
 \ /
  Last update: 2009-11-02 08:33    [W:0.141 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site