sys_sysinfo()'s bug in reporting the number of processes

From: Anton Lavrentiev (lavr@ncbi.nlm.nih.gov)
Date: Tue Feb 26 2002 - 17:06:29 EST


Dear Linux Developers:

I've noticed discrepancy in the number of processes
returned by sysinfo() syscall versus the number of processes
listed by 'ps'. The problem traced down to the following line
of code in kernel/info.c:

val.proc = nr_task-1;

as if the idle task is taken into account in 'nr_tasks',
However, since kernel 2.2 the comment to (and the usage of)
'nr_task' explicitly states that the idle task is not anymore
counted in this variable. From kernel/fork.c:

/* The idle tasks do not count.. */
int nr_tasks = 0;

As a matter of fact, prior to kernel 2.2 the initial value of
'nr_tasks' was 1, and the idle task 0 was counted, so the
correction by -1 was really necessary. But it was forgotten
to undo this subtraction when the 'nr_tasks' had changed its
meaning since then.

Best regards,

Anton Lavrentiev
NCBI/NLM/NIH
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Feb 28 2002 - 21:00:33 EST