]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lscpu: fix threads-per-core calculation
authorKarel Zak <kzak@redhat.com>
Thu, 31 Mar 2011 10:55:13 +0000 (12:55 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 19 Apr 2011 11:09:53 +0000 (13:09 +0200)
commita62dd1d0758e3ad3daee8702dfe71d3d2c82db2e
treef80a7f275a69eae1f5bdb187c8ecf30336fcb384
parent3675223dc3ab80186cc300497fd5962624d42ef5
lscpu: fix threads-per-core calculation

On Thu, Mar 24, 2011 at 01:45:34PM +0100, Jan Engelhardt wrote:
> On a 24-thread/6-core SPARC T1, lscpu would wrongly output "5
> threads per core".
>
> It seems that the 6c T1 is simply an 8c T1 where 2c are disabled
> (offering a lesser model for a lower price, and all that marketing
> fluff). So the machine description header of the 6c T1 reports 32
> threads, but only goes on to provide 24 elements thereafter, which
> is why Linux will report threads 24-31 as "offline". So far so good.
>
> But lscpu would take the number of all (online and offline) threads
> (32) and divides it by the number of online cores (6), which yields
> an odd 5.33 threads/core.
>
> Simply pick the number of online threads.

Based on Jan's patch.

Reported-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu.c