]> 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>
Thu, 31 Mar 2011 10:55:13 +0000 (12:55 +0200)
commite282eec2a259903a02841f516b7778a1f639d8ff
tree54eb17c5d16cba8e87815c8011d01265fe0dc3b8
parentf0fc846a532befa1c37e2da97ecb97fe2031c26d
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