|
@@ -442,12 +442,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);
|
|
|
}
|