[lkml]   [2002]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: system call for finding the number of cpus??

On 8 Apr 2002, H. Peter Anvin wrote:
> By author: Christoph Hellwig <>
> > On Mon, Apr 08, 2002 at 05:25:08PM -0400, Robert Love wrote:
> > > Linux does not implement such a syscall. Note
> > >
> > > cat /proc/cpuinfo | grep processor | wc -l
> >
> > I guess there is at least one architecture on which it breaks..
> >
> Then that architecture should be fixed.

Back in 1999 or so I actually came up with a patch that more-or-less came
up with an arch-independent /proc/cpuinfo file. It touched off a
mini-flamewar on linux-kernel, none of the arch maintainers wanted to
change their pet format, and Linus silently dropped the patch.

As maintainer of linux_logo I have to have a separate cpuinfo parser for
each architecture.

For number of CPU's..... x86 uses the "count processor/bogomips" type
thing. Some architectures actually have an "active cpus:" type field.
Some have a "processors total:" type field. And often the method that
works changes from kernel to kernel, sometimes even within stable

But no, counting processors or bogomips doesn't work across the board.

Should this be rectified somehow? I think it would take a proclomation
from on high.

What to do in the meantime? Well the sysconf() method sounds promising.
If not you can dig out the sysinfo library included with linux_logo which
does a reasonable job with most of the common architectures.


\ /\ /\ / Vince Weaver Linux 2.4.9 on a K6-2+, Up 45 days

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:25    [W:0.106 / U:7.156 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site