[RndTbl] reliable way of counting real CPUs under Linux?

Gilbert E. Detillieux gedetil at cs.umanitoba.ca
Tue Apr 22 15:55:00 CDT 2014

This article from several years ago suggests AMD processors did not 
support hyper-threading...


...  but suggests they may in the future.  A talk with my CPU-savvy 
co-worker confirmed that AMD has never supported HT, and likely wouldn't 

So, that raises the question:  What exactly does the "ht" flag in 
/proc/cpuinfo mean, then, if it's not the existence of HT?  This thread 
offers some insight...


So, the "ht" flag seems to just indicate a processor's ability to detect 
siblings, whether they're actual cores or just HT.  Misleading, yes, but 
they chose to leave it that way rather than break the ABI.

Let's leave an obscure, misleading flag in a particular /proc file 
alone, to avoid breaking things for some programmer, somewhere, who may 
be doing some weird test that would be better done in some other way. 
But, on the other hand, let's completely change the way all process and 
device initialization happens in a very fundamental way, regardless of 
how many scripts and 3rd-party services break as a result...

Gotta love Linux!  (OK, that may be an unfair juxtaposition, since we're 
talking about kernel vs user space, and different groups of people 
supporting these, with radically different priorities and methods.  But 
still...  Ugh!)


On 21/04/2014 9:02 AM, Grigory Shamov wrote:
> Dear Gilbert,
> On 14-04-17 4:33 PM, "Gilbert E. Detillieux" <gedetil at cs.umanitoba.ca>
> wrote:
>> On 17/04/2014 4:01 PM, Grigory Shamov wrote:
>>> Hi Gilbert,
>>> Thanks!
>>> There is a lot of advice there for sure. For example, The 'ht' flag is
>>> always there on our AMD Opterons (Shaghais and Barcelonas), even they do
>>> not have HT enabled. I'd think that 'ht' it is always there in any
>>> SMP-enabled linux kernel?
>> More likely, it's always there for any processor that supports HT,
>> whether it's currently enabled or not.
> Do you know if AMD Opterons support HT?
> model name	: Quad-Core AMD Opteron(tm) Processor 2376
> flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
> pse36 clflush mmx fxsr sse sse2 *ht* etc. etc.
> model name	: Six-Core AMD Opteron(tm) Processor 2431
> flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
> pse36 clflush mmx fxsr sse sse2 *ht* etc. etc.

Gilbert E. Detillieux		E-mail: <gedetil at muug.mb.ca>
Manitoba UNIX User Group	Web:	http://www.muug.mb.ca/
PO Box 130 St-Boniface		Phone:  (204)474-8161
Winnipeg MB CANADA  R2H 3B4	Fax:    (204)474-7609

More information about the Roundtable mailing list