summaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2010-04-30 13:37:29 -0700
committerJoel Becker <joel.becker@oracle.com>2010-04-30 13:37:29 -0700
commitf9221fd80343285514568da6c5dbda0f87109de8 (patch)
tree3a2f0077ebea9d094bdeedb319c97cb591d51c51 /fs/proc/base.c
parenta36d515c7a2dfacebcf41729f6812dbc424ebcf0 (diff)
parenta9743fcdc0eb43d028b71267438076e1b0112ba0 (diff)
downloadlinux-f9221fd80343285514568da6c5dbda0f87109de8.tar.bz2
Merge branch 'skip_delete_inode' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2-mark into ocfs2-fixes
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a7310841c831..7621db800a74 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -81,6 +81,7 @@
#include <linux/elf.h>
#include <linux/pid_namespace.h>
#include <linux/fs_struct.h>
+#include <linux/slab.h>
#include "internal.h"
/* NOTE:
@@ -442,12 +443,13 @@ static const struct file_operations proc_lstats_operations = {
unsigned long badness(struct task_struct *p, unsigned long uptime);
static int proc_oom_score(struct task_struct *task, char *buffer)
{
- unsigned long points;
+ unsigned long points = 0;
struct timespec uptime;
do_posix_clock_monotonic_gettime(&uptime);
read_lock(&tasklist_lock);
- points = badness(task->group_leader, uptime.tv_sec);
+ if (pid_alive(task))
+ points = badness(task, uptime.tv_sec);
read_unlock(&tasklist_lock);
return sprintf(buffer, "%lu\n", points);
}