diff -NurpP linux-2.6.22.2-vs2.3.0.17.6/include/linux/vserver/context.h linux-2.6.22.2-vs2.3.0.17.7/include/linux/vserver/context.h --- linux-2.6.22.2-vs2.3.0.17.6/include/linux/vserver/context.h 2007-08-12 00:31:10 +0200 +++ linux-2.6.22.2-vs2.3.0.17.7/include/linux/vserver/context.h 2007-08-19 00:03:22 +0200 @@ -107,6 +107,7 @@ struct vx_info { struct task_struct *vx_reaper; /* guest reaper process */ pid_t vx_initpid; /* PID of guest init */ + int64_t vx_badness_bias; /* OOM points bias */ struct _vx_limit limit; /* vserver limits */ struct _vx_sched sched; /* vserver scheduler */ diff -NurpP linux-2.6.22.2-vs2.3.0.17.6/include/linux/vserver/context_cmd.h linux-2.6.22.2-vs2.3.0.17.7/include/linux/vserver/context_cmd.h --- linux-2.6.22.2-vs2.3.0.17.6/include/linux/vserver/context_cmd.h 2007-08-15 20:06:48 +0200 +++ linux-2.6.22.2-vs2.3.0.17.7/include/linux/vserver/context_cmd.h 2007-08-19 00:40:28 +0200 @@ -109,4 +109,20 @@ extern int vc_get_bcaps(struct vx_info * extern int vc_set_bcaps(struct vx_info *, void __user *); #endif /* __KERNEL__ */ + + +/* OOM badness */ + +#define VCMD_get_badness VC_CMD(MEMCTRL, 5, 0) +#define VCMD_set_badness VC_CMD(MEMCTRL, 6, 0) + +struct vcmd_badness_v0 { + int64_t bias; +}; + +#ifdef __KERNEL__ +extern int vc_get_badness(struct vx_info *, void __user *); +extern int vc_set_badness(struct vx_info *, void __user *); + +#endif /* __KERNEL__ */ #endif /* _VX_CONTEXT_CMD_H */ diff -NurpP linux-2.6.22.2-vs2.3.0.17.6/include/linux/vserver/switch.h linux-2.6.22.2-vs2.3.0.17.7/include/linux/vserver/switch.h --- linux-2.6.22.2-vs2.3.0.17.6/include/linux/vserver/switch.h 2007-08-15 18:39:33 +0200 +++ linux-2.6.22.2-vs2.3.0.17.7/include/linux/vserver/switch.h 2007-08-19 00:27:16 +0200 @@ -25,7 +25,7 @@ CPU | |VPROC |PROCALT|PROCMIG|PROCTRL| | |SCHED. | | PROCESS| 08| 09| 10| 11| 12| 13| | 14| 15| -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ - MEMORY | | | | | | | |SWAP | | + MEMORY | | | | |MEMCTRL| | |SWAP | | | 16| 17| 18| 19| 20| 21| | 22| 23| -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ NETWORK| |VNET |NETALT |NETMIG |NETCTL | | |SERIAL | | @@ -57,6 +57,7 @@ #define VC_CAT_PROCTRL 12 #define VC_CAT_SCHED 14 +#define VC_CAT_MEMCTRL 20 #define VC_CAT_VNET 25 #define VC_CAT_NETALT 26 diff -NurpP linux-2.6.22.2-vs2.3.0.17.6/kernel/vserver/context.c linux-2.6.22.2-vs2.3.0.17.7/kernel/vserver/context.c --- linux-2.6.22.2-vs2.3.0.17.6/kernel/vserver/context.c 2007-08-16 03:33:52 +0200 +++ linux-2.6.22.2-vs2.3.0.17.7/kernel/vserver/context.c 2007-08-19 00:08:15 +0200 @@ -91,6 +91,7 @@ static struct vx_info *__alloc_vx_info(x /* prepare reaper */ get_task_struct(init_pid_ns.child_reaper); new->vx_reaper = init_pid_ns.child_reaper; + new->vx_badness_bias = 0; /* rest of init goes here */ vx_info_init_limit(&new->limit); diff -NurpP linux-2.6.22.2-vs2.3.0.17.6/kernel/vserver/limit.c linux-2.6.22.2-vs2.3.0.17.7/kernel/vserver/limit.c --- linux-2.6.22.2-vs2.3.0.17.6/kernel/vserver/limit.c 2007-08-15 22:29:48 +0200 +++ linux-2.6.22.2-vs2.3.0.17.7/kernel/vserver/limit.c 2007-08-19 00:08:19 +0200 @@ -307,9 +307,11 @@ unsigned long vx_badness(struct task_str if (!vxi) return 0; + points = vxi->vx_badness_bias; + v = __vx_cres_array_fixup(&vxi->limit, VLA_RSS); w = __rlim_soft(&vxi->limit, RLIMIT_RSS); - points = (v > w) ? (v - w) : 0; + points += (v > w) ? (v - w) : 0; return points; } diff -NurpP linux-2.6.22.2-vs2.3.0.17.6/kernel/vserver/proc.c linux-2.6.22.2-vs2.3.0.17.7/kernel/vserver/proc.c --- linux-2.6.22.2-vs2.3.0.17.6/kernel/vserver/proc.c 2007-08-15 23:24:01 +0200 +++ linux-2.6.22.2-vs2.3.0.17.7/kernel/vserver/proc.c 2007-08-19 05:09:12 +0200 @@ -81,10 +81,12 @@ int proc_vxi_info(struct vx_info *vxi, c length = sprintf(buffer, "ID:\t%d\n" "Info:\t%p\n" - "Init:\t%d\n", + "Init:\t%d\n" + "OOM:\t%lld\n", vxi->vx_id, vxi, - vxi->vx_initpid); + vxi->vx_initpid, + vxi->vx_badness_bias); return length; }