Re: [LAU] How to turn off hyperthreading?

From: Jeremy Jongepier <jeremy@email-addr-hidden>
Date: Sun Dec 22 2013 - 22:03:54 EET

On 12/22/2013 05:23 PM, Len Ovens wrote:
>
> On Sat, 21 Dec 2013, david wrote:
>
>> Too, late, already have the machine with the i7. I think it only cost
>> $15 more than the i5 option. I this particular model's i5 base
>> processor has a lower clock rate than the i7 started with.
>>
>> Just checked the BIOS. No option to turn of hyperthreading.
>>
> In linux each hyperthread is treated as another core. So if you have 4
> cores, it will look like 8 with hyperthreading on. Every second cpu that
> linux sees is a hyperthread. so you only want cpu 0,2,4,and 6. There is
> a kernel command line option to have the kernel ignore some cpus, get it
> to ignore cpu 1,3,5 and 7. I seem to be off line right now so I can't
> look it up. Ah, back up.
> isolcpus= cpu_number[, cpu_number,...]
>
> The blurb for that:
> "Remove the specified CPUs, as defined by the cpu_number values, from
> the general kernel SMP balancing and scheduler algroithms. The only way
> to move a process onto or off an "isolated" CPU is via the CPU affinity
> syscalls. cpu_number begins at 0, so the maximum value is 1 less than
> the number of CPUs on the system.
>
> This option is the preferred way to isolate CPUs. The alternative,
> manually setting the CPU mask of all tasks in the system, can cause
> problems and suboptimal load balancer performance."
>
> The place to add this to your system (if you don't want enter it every
> time you boot) is in GRUBs config. The best place to do this varies with
> the ditro. For example, I have found the best place to do this on a
> Ubuntu system is in /etc/default/grub.d/ as it does not interfere with
> upgrades.
>
> The place you will see mentioned more often is a file called
> /etc/default/grub Look for a line like GRUB_CMDLINE_LINUX="" and edit it
> (as root of course) to:
> GRUB_CMDLINE_LINUX="isolcpus= 1,3,5,7"
>
> If you have more than 4 cores(6 or 8), I do not know if cpus higher than
> 9 are in hex or dec.
>
> If you wish to have grub menu options to boot either way.... I would
> guess it is time to learn more about GRUB :) It is easy to add menu
> items on a static system, but gets much harder on a system with lots of
> updates.
>
> Hmm, there seem to be a lot of irq options too. I wonder if they would
> be able to force better irq assignment within the system. I know telling
> the bios not to select irqs for USB gives better irq layout for me.
>
> Anyway, the list of kernel options I based this on is from:
> http://oreilly.com/linux/excerpts/9780596100797/kernel-boot-command-line-parameter-reference.html
>
>
>
> -- Len Ovens www.ovenwerks.net

Hello Len,

Thanks for the valuable information! If you don't mind I'll add it to
http://wiki.linuxaudio.org/wiki/system%20configuration

I thought just disabling them like:

CPU=( cpu1 cpu3 cpu5 cpu7 )
for i in "${CPU[@]}"
do
  echo 0 > /sys/devices/system/cpu/$i/online
done

would do the trick too but on my own system I still can't go lower than
-p128 so hopefully the isolcpus parameter improves stability.

Best,

Jeremy

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user

Received on Mon Dec 23 00:15:03 2013

This archive was generated by hypermail 2.1.8 : Mon Dec 23 2013 - 00:15:04 EET