diff -NurpP linux-2.6.31.1-vs2.3.0.36.14-pre9/fs/proc/base.c linux-2.6.31.1-vs2.3.0.36.14-pre10/fs/proc/base.c --- linux-2.6.31.1-vs2.3.0.36.14-pre9/fs/proc/base.c 2009-09-29 16:52:37.000000000 +0200 +++ linux-2.6.31.1-vs2.3.0.36.14-pre10/fs/proc/base.c 2009-09-30 03:08:47.000000000 +0200 @@ -1039,6 +1039,9 @@ static ssize_t oom_adjust_write(struct f put_task_struct(task); return -EACCES; } + /* prevent guest processes from circumventing the oom killer */ + if (vx_current_xid() && (oom_adjust == OOM_DISABLE)) + oom_adjust = OOM_ADJUST_MIN; task->oomkilladj = oom_adjust; put_task_struct(task); if (end - buffer == 0) diff -NurpP linux-2.6.31.1-vs2.3.0.36.14-pre9/include/linux/vs_context.h linux-2.6.31.1-vs2.3.0.36.14-pre10/include/linux/vs_context.h --- linux-2.6.31.1-vs2.3.0.36.14-pre9/include/linux/vs_context.h 2009-09-10 16:11:43.000000000 +0200 +++ linux-2.6.31.1-vs2.3.0.36.14-pre10/include/linux/vs_context.h 2009-09-30 02:28:59.000000000 +0200 @@ -218,6 +218,21 @@ static inline void __leave_vx_admin(stru (void)xchg(¤t->vx_info, vxis->vxi); } +#define task_is_init(p) \ + __task_is_init(p, __FILE__, __LINE__, __HERE__) + +static inline int __task_is_init(struct task_struct *p, + const char *_file, int _line, void *_here) +{ + int is_init = is_global_init(p); + + task_lock(p); + if (p->vx_info) + is_init = p->vx_info->vx_initpid == p->pid; + task_unlock(p); + return is_init; +} + extern void exit_vx_info(struct task_struct *, int); extern void exit_vx_info_early(struct task_struct *, int); diff -NurpP linux-2.6.31.1-vs2.3.0.36.14-pre9/mm/oom_kill.c linux-2.6.31.1-vs2.3.0.36.14-pre10/mm/oom_kill.c --- linux-2.6.31.1-vs2.3.0.36.14-pre9/mm/oom_kill.c 2009-09-29 17:34:31.000000000 +0200 +++ linux-2.6.31.1-vs2.3.0.36.14-pre10/mm/oom_kill.c 2009-09-30 02:30:43.000000000 +0200 @@ -28,6 +28,7 @@ #include #include #include +#include int sysctl_panic_on_oom; int sysctl_oom_kill_allocating_task; @@ -73,12 +74,6 @@ unsigned long badness(struct task_struct points = mm->total_vm; /* - * add points for context badness - */ - - points += vx_badness(p, mm); - - /* * After this unlock we can no longer dereference local variable `mm' */ task_unlock(p); @@ -166,6 +161,12 @@ unsigned long badness(struct task_struct points >>= -(p->oomkilladj); } + /* + * add points for context badness + */ + + points += vx_badness(p, mm); + #ifdef DEBUG printk(KERN_DEBUG "OOMkill: task %d:#%u (%s) got %d points\n", task_pid_nr(p), p->xid, p->comm, points); @@ -210,6 +211,7 @@ static struct task_struct *select_bad_pr struct task_struct *g, *p; struct task_struct *chosen = NULL; struct timespec uptime; + xid_t xid = vx_current_xid(); *ppoints = 0; do_posix_clock_monotonic_gettime(&uptime); @@ -222,11 +224,14 @@ static struct task_struct *select_bad_pr */ if (!p->mm) continue; - /* skip the init task */ - if (is_global_init(p)) + /* skip the init task, global and per guest */ + if (task_is_init(p)) continue; if (mem && !task_in_mem_cgroup(p, mem)) continue; + /* skip other guest and host processes if oom in guest */ + if (xid && p->xid != xid) + continue; /* * This task already has access to memory reserves and is