[RFC][PATCH 1/1] MAZE: Mazed processes monitor

Previous thread: [RFC][PATCH 0/1] MAZE: Mazed processes monitor by Hirofumi Nakagawa on Tuesday, May 13, 2008 - 4:47 am. (6 messages)

Next thread: Re: [PATCH -mm 05/15] free swap space on swap-in/activation by Daisuke Nishimura on Tuesday, May 13, 2008 - 5:39 am. (1 message)
From: Hirofumi Nakagawa
Date: Tuesday, May 13, 2008 - 4:47 am

This patch for linux-2.6.25-mm1 that is tested on x86_64 hardware.

Signed-off-by: Hirofumi Nakagawa <hnakagawa@miraclelinux.com>
---
 include/linux/maze.h  |   92 +++++++++
 include/linux/sched.h |    3
 init/Kconfig          |   10 +
 init/main.c           |    2
 kernel/Makefile       |    1
 kernel/exit.c         |    2
 kernel/fork.c         |    2
 kernel/maze.c         |  466 ++++++++++++++++++++++++++++++++++++++++++++++++++
 kernel/sched.c        |    3
 9 files changed, 581 insertions(+)

--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.25-mm1-maze/include/linux/maze.h	2008-05-13 17:52:23.000000000 +0900
@@ -0,0 +1,92 @@
+/*
+ *  Copyright (C) 2007-2008 MIRACLE LINUX Corp.
+ *
+ *  Written by Hirofumi Nakagawa <hnakagawa@miraclelinux.com>
+ *
+ *	This program is free software; you can redistribute it and/or
+ *	modify it under the terms of the GNU General Public License as
+ *	published by the Free Software Foundation, version 2.
+ */
+#ifndef _LINUX_MAZE_H
+#define _LINUX_MAZE_H
+
+#ifdef __KERNEL__
+
+#include <linux/sched.h>
+#include <linux/list.h>
+
+struct maze_context {
+	struct task_struct *task;
+	int pid;
+
+	/* The stime of task when the maze count was reseted */
+	cputime_t reset_stime;
+	/* The utime of task when the maze count was reseted */
+	cputime_t reset_utime;
+
+	/* The soft limit of maze count */
+	unsigned long soft_limit;
+	/* THe hard limit of maze count */
+	unsigned long hard_limit;
+
+	/* The send signal when the maze count reach soft limit */
+	int soft_signal;
+	/* The send signal when the maze count reach hard limit */
+	int hard_signal;
+
+#define MAZE_SENT_SOFT_SIG  1
+#define MAZE_SENT_HARD_SIG  2
+	/* The flags of sent signal */
+	unsigned long flags;
+
+	/* This value is 1, if maze_context is enqueueing */
+	int enqueue;
+	/* This value is cpu number of enqueueing */
+	int enqueue_cpu;
+
+	/* This value is 1, if preempt_notifier is registered */
+	atomic_t ...
From: Andrew Morton
Date: Tuesday, May 13, 2008 - 9:04 am

These three can be static?

Please document the data structures here at their definition sites with
code comments: what they are used for, what their locking rules are. 
Also, a per-cpu spinlock is somewhat unusual and a few words describing

There's a moderate amount of whitespace brokenness in here. 

The code uses `inline' too much, and is probably slower as a result. 

Please update the description of task_lock() in sched.h when adding new
rules to it.  I assume that it protects task_struct.maze_context.

I'm a little surprised to see a global lock being taken under
task_lock(): generally I think of task_lock() as a low-level thing
which protects only task internals.  I assume this code was runtime
tested with lockdep enabled?

But that doesn't mean that the chosen lock ranking is desirable.  From


GFP_ATOMIC is weak, and can fail.  With some reorganisation this could



pids are not unique in a containerised system.  What are the


It is odd that the timer runs every ten jiffies.  Because jiffies can
alter by a factor of ten, depending upon Kconfig settings and
architecture, etc.

Having numerous timers expire once per ten jiffies will be a power
consumption problem for some people.  Can this be fixed?

There's not really enough information in either code comments or the







I am unable to tell from the implementation why late_initcall() was
chosen instead of plain old __initcall() (or module_innit()).  Please
--

Previous thread: [RFC][PATCH 0/1] MAZE: Mazed processes monitor by Hirofumi Nakagawa on Tuesday, May 13, 2008 - 4:47 am. (6 messages)

Next thread: Re: [PATCH -mm 05/15] free swap space on swap-in/activation by Daisuke Nishimura on Tuesday, May 13, 2008 - 5:39 am. (1 message)