mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* sys_sysinfo()'s bug in reporting the number of processes
@ 2002-02-26 22:06 Anton Lavrentiev
  0 siblings, 0 replies; only message in thread
From: Anton Lavrentiev @ 2002-02-26 22:06 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-02-26 22:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-26 22:06 sys_sysinfo()'s bug in reporting the number of processes Anton Lavrentiev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®