Linux: Low CPU Clocks on laptop while gaming?

So, this is my first post after reading these forums for a while without an account, and this place seems like a great community to take part in(So sorry that my first contribution is a question, but it has been bugging me for ages).
I am using a laptop with an i7-4720hq, 8gb of ram and an nvidia gtx970m. Currently it is dual-booted with windows 10 and ubuntu 17.04.

When I am using the much-preferred ubuntu (partially to get round a strange problem with some full screen games on windows, but that topic is for another day) to play games such as dirt rally or some source engine games, my CPU clocks down to 800MHz(the minimum allowed HW clock). This results in less than 50% GPU utilization, and an unplayable framerate. I have tried setting the minimum clock speed and the mode to performance with cpufreq-utils, and while they take affect normally, while in game the CPU still slowly clocks down to 800/900MHz. This may be because there is never really 100% utilization on any core, but because of the limit on GPU usage when the CPU clocks down, it is clearly affecting the performance. I have also tried stressing the GPU to max usage with glxgears, and the CPU still manages to reach it's base clock under slightly more intensive normal usage(not fully stressed, but 2.6GHz would be perfectly respectable for my needs). Do any of you have some advice for how I can resolve this? Gaming using my ubuntu install is far more enjoyable(and faster), and also makes it easier to do my programming and other work.

Try enabling high performance mode in windows settings. And check your temps.

Is there a good command-line utility or a file that can be read to check CPU temps in linux so that I can see if they relate to the clock speed changes? Unfortunately, changing modes in windows will not affect this problem, because I only seem to experience it when running my ubuntu install. On windows, the performance seems to generally be lower without a clear cause(everything seems to run fine; clocks, temps, etc. It is just slower), but that is not much of an issue to me if I can get my ubuntu install working well.

umm im not good with linux id say try windows first.

Windows seems to be working fine, and while it is slower, it will do for my windows only software, The CPU clock remains above 3 GHz while playing games on windows, meaning that it must be a software issue for linux. So, I know that I can move back to windows if no solution is found for linux in the next while.

ya. idk what else to try sorry.

I believe "sensors" is a decent command-line utility to check temps but it has been ages since I last used it. The more recent utility I was using is openhardwaremonitor. It has it's own gui and seems to work quite well, again it's been a little while since I last used it but I would try that to see what your temps are doing.

A side from high temps I wouldn't really know what else would be causing the issue. I am not a HUGE linux user but opensuse and MX-16(which are what I use) don't seem to have that issue. I play games such as Ark without any problems a side from the rare/odd graphical glitch.

Using a dual E5-2670 workstation at home and an i5-3450 at work, both with no cpu issues from what I have seen.

CPU speeds are handled by a governor in linux, which you can modify if you compile your own kernel if you really wanted to. Not gonna go into that here, just letting you know how it works.

By default, it should be set to scale performance with demand; you really shouldn't have to worry.

SInce your CPU is down-clocking its frequency, that would mean that it is getting too hot.

If it has been 2 or more years, change the thermal paste on the heatsink.



sudo apt-get install lm-sensors
sudo sensors-detect


Thanks for the recommendation of sensors @Gurf and @Dynamic_Gravity. It seems to work well, and reports that I do indeed appear to be hitting the "high" temperature, and then the clock speed slowly goes down once that happens(slower to reach 1 GHz ~ 800 MHz than my previous observations though). I think that the laptop should be just about nearing two years old.

However, this actually leaves me more confused than before because when I am using windows, the clock speed seems to be maintaining a full turbo boost speed while gaming (3.4 GHz). However, I do experience lower performance in windows for everything(games, programming, etc). Could that be because the GPU is on a lower power mode on windows, to allow the CPU to keep a high clock?

I think that under linux, the laptop is using intel-pstate. Is there a way to change the "high" temperature to something a bit higher (I think that I would be comfortable running the CPU hot, ~92 instead of 84 because having decent performance on my preferred OS is probably worth a slightly shorter lifespan)?

You have a hybrid system; a discrete and integrated gpu.

I think that linux is by default using the nvidia one all the time, while windows is using the weaker integrated gpu (unless specified). Couple this with different power settings, because each handles things differently.

They work in tandem but do not affect each other in the way you are thinking. The components automatically downclock themselves when they are too hot, this is known as thermal throttling.

This is baked into the firmware and cannot be overwritten. And it is actually 105 C when an intel CPU will typically downclock itself to avoid death. 95 C for typical GPU's.

Note: while it may say 92 C for your system, that is an average of the cores in your CPU, each core does not run at the exact same temperature. If one is spiking to its TJmax then it will still throttle.

Bottom Line

If your laptop is hitting its thermal junction then you really need to invest in better cooling; cooling pads, extra heatsinks, reapply thermal paste, anything to improve thermals.

It's weird that you're able to hit a solid 3GHz in Windows and in Linux you're magically at the Tjmax temperature. It's not an hardware problem if you're hitting high temperatures in Linux. I know fan speeds are handled through BIOS but I would check anyway if during games the fans on Windows and Linux are spinning at the same speed. Also I would check the voltages on the CPU and the GPU during load, just to make sure that everything's okay.

I had a quick look at msi afterburner on windows while running a game, and it appears that it is letting the CPU reach the mid 90s before reducing clock, and it only reduces to 3.2 GHz. This contrasts the Linux governor, which appears to reduce clock a lot when the temp reaches 84.

Seems windows is more apt to let the CPU bake itself.

What is your plan to improve cooling in your system?

Well firstly hello and welcome. A CPU on a laptop lowering down could be from heat or the power mode,. U did state you turned up performance, perhaps your hitting a thermal limit.

You could run glxgears and stress -c 4 to check it out

We've already determined his CPU is thermal throttling, and we had him use sensors to monitor to get the results.

The issue, is it throttles more in linux than it does in windows; we are trying to find out why.

Sorry I stepped well over stepped :(. Windows vs Linux is all software....I Hate laptops on but there is prolly drivers that let it the machine clock higher than default on windows. A bit like overclocking but through windows. some dell or HP DLL.

A default install under windows vs linux no drivers loaderd could tell. Windows does like to auto load drivers however.

@anon42572516 I found the article you need to read which will explain this situation.

Try telling linux to go hard and be more performance oriented by changing your governor.

To activate a particular governor, run:
# cpupower frequency-set -g performance

That at least should get us on a level playing field as what Windows is doing.

1 Like

Apologies for such a delay in posting, but I have now been able to run some more tests.
After setting the governor to performance for all cores, the system now prefers the base (2.6 GHz) clock as a base setting, however when run with glxgears to stress the GPU and stress -c 8, the clock speed seems to drop as soon as the CPU hits 84, eventually ending up at a relatively stable 1.6GHz (drops and climbs a little, but that would be the most common speed). In windows while using a game to stress the GPU and CPU, the clock speed is stable in the boost frequencies (3.2 GHz, can go up to 3.4), and the CPU seems to hover around 92 in temperature. I would be comfortable running my CPU with linux set to use that as the temp before dropping clock speed to see if that makes performance acceptable (I would like to be able to maintain the base speed if possible, anything else could be considered a bonus). Is there a way to change what the governor considers a 'high' temperature so that It does not reduce clock until that is reached? I think that on ubuntu, my system is using intel-pstate.

An interesting side note: the performance governor on linux seem to keep all cores within 200MHz of each other, even in a single thread workload, rather than only increasing one core for that to run on. I do not know if windows does this, since the task manager only shows a frequency for one core.

There also might be something in your bios itself that is screwing with you. I know with my Asus G50VT that I had to go in the bios and screw with CPU settings to have it not ramp the clock down significantly and just boost the fan. (Luckily I put in a giant fan from an imac lol)