Is there anything we can do to not lose as much performance from the Meltdown and Specter patches?

specter and meltdown logos on a die shot of the wafer

Intel wanted to excuse that Meltdown and Specter it was his problem, then he rectified and made a public statement in which he cited AMD and ARM as technology partners that he was working with to solve the problem and in that way point them out as well, but both ARM and AMD are not so affected due to these vulnerabilities as Intel is, since Meltdown is almost exclusive to Intel microprocessors (and some ARMs) and Specter does affect more microprocessors, but not to the same extent and Intel again takes the worst part.

They were also quick to say that loss of performance it would be almost nil, that users would not notice it after installing the patches. And it is true that there is not a loss as dramatic as expected in most cases, but it is true that depending on the generation of your chip the loss can be minimal or quite severe. They have already recognized it and now they have already carried out some tests with benchmarks to calculate the losses that you can have in the Intel after installing the corresponding patches on your system, and although the tests were carried out with Microsoft Windows, for Linux and other systems such as macOS will be similar ...

Estimated performance losses ...

CPU swap with a toy excavator

As I say, that 30% loss of performance is not quite like that, at least in the latest CPU models released. While the older your chip the more performance loss it will mean updating with the Meltdown and Specter patches. The tests carried out by Intel should be taken with tweezers, since I suppose that the chosen benchmarks benefit the manufacturer and have not been put in the worst case, in addition the measurements were made taking into account the most daily applications that a user uses medium, but as you know depending on the software it can vary.

Intel has also made another cheat for measurements, and that is use SSD drives in all the equipment that he has used, something that would be one of the improvements that we could make ourselves to fight against the impact. Yes, if we change an HDD for an SSD, the access speed for the latter would be much faster and the emptying of the TLB would mean a lower loss than what could be given in a conventional hard disk. Therefore, if you have an HDD the data from these Intel tests are quite optimistic and you should not expect to get the data from these benchmarks. In addition, the tests have not been carried out with all the models but have chosen one of each generation, I suppose that they have again selected those that show the most positive data for the image of the brand.

The results have been:

  • Intel Core 8th Generation (Kaby Lake and Coffe Lake): It is estimated that the average performance impact would be 6% for most activities and in web applications such as the execution of JavaScript code you could see a loss of up to 10%.
  • Intel Core 7th Generation (Kaby Lake-H): here for office applications and others the performance would drop by 7%, one point more than in the previous case and in the case of web applications it would also increase a little compared to the 8th.
  • 6th Gen Intel Core (Skylake-S): around 8% usually… But a specific test called Responsiveness from SYSMark 2014 SE has detected losses of up to 79% even when using the SSD.
  • Intel prior to this: Well, no tests have been carried out at the moment, at least not public, but with each generation you should add more loss points to what was seen in the last three, since these last three are supposed to be the ones in which the loss is much less. What about processors from 10 years ago for example? We will see the response of users ...

With the workloads tested by Intel the losses are these for those generations, but ...and with higher workloads? I think there will be more controversies from disgruntled users soon. Of course, gamers can be a little more calm because video games do not need too many calls to the system for their operation, the performance drop for them is not so noticeable and can be around 2% and the FPS is practically not damaged.

How to improve performance from a physical point of view?

robot replacing cpu

As to hardware we can invest a little money to compensate for the loss of performance:

  • CPU: we can upgrade the CPU to a more modern model if our socket and chipset supports it, thus the gains from including a more modern microarchitecture or a processor with superior characteristics could camouflage this loss of performance, although obviously the same as your previous chip, the new will also have a performance loss relative to the unpatched system. The logical thing would be not to update the microprocessor unless we have a very old one and the loss is notorious and we already have it amortized to think about a change.
  • RAM: Expanding the RAM would not hurt either, since we could raise the performance a bit and make the loss of performance more bearable. In this case, perhaps it is for those who have a more modern microprocessor and do not want to change it but for an outlay of not too much money we could compare a new module thus avoiding the use of secondary memory (SWAP) to store process data and that the microprocessor takes even more cycles to drain from the TLB.
  • HDD: It can also be a good option to include an SSD in our equipment, this will significantly improve performance by significantly reducing the access time to this memory with respect to HDDs. That is why the performance impact with SSDs will be much less, which is why Intel used them to do the tests. You can always leave your HDD as a disk for data and the SSD for software.
  • overclock: As long as you know what you're doing, maybe now is a good time to bet on overclocking your system to get a few hundred megahertz unlocked in your CPU ... But don't forget that this can cause stability problems in some chips and especially you should improve the cooling, therefore it will also imply an economic cost.

Certainly none of the hardware changes are too cheap, and if we want to recover part of the performance, we will have to spend money. Obviously not all users need to do this, only those for whom performance is critical. Also, if your CPU is of the latest generations, you see that the losses are not so huge, and you should only consider a change of components when your equipment is older or when the applications you use do notice more the detriment of patches such as databases, etc.

How to improve software performance?

Lettering on dark background

Discarding the money outlays of touching our hardware we should ask ourselves if with the same hardware we have we can do something in our GNU / Linux distribution so that the loss of performance is not so noticeable. The answer is that we can probably do something and it is any practice that by changing the settings can help performance. And surely some of these configurations you already know:

  • AMD: If you have an AMD CPU you should avoid patches, although this is a risk, since these chips are not completely Specter free but it is true that the risk is much lower due to the architectural differences between Intel and AMD ... Anyway Sooner or later a kernel will arrive in which you already have these serial patches and it would not be good to use a kernel without updating for other possible problems. The best is a configuration mechanism to disable this on certain CPUs ...
  • swappiness: I would not particularly touch the kernel parameter regarding Cache Pressure, but we could modify the Swappiness especially if we have an HDD, since in the case of having an SSD the difference would be less. The value of Swappines causes the kernel to modify the priority of RAM / SWAP usage. A value of 0 or low means that the SWAP will not be used as much so it will benefit a little from the performance loss after installing the Specter and Meltdown patches. However, it would be advisable to have a large RAM so that this step does not affect performance on the other hand. If you have a good RAM capacity and an HDD, avoid values ​​high or close to 100 because they will make more use of the swap SWAP partition and will leave the RAM emptier, therefore it will take longer to access data and instructions hosted there. To see the current value of your Swappiness we can use the cat concatenator and to modify the sysctl value, for example to put 10% use of SWAP and 90% for RAM:
cat /proc/sys/vm/swappiness

sysctl -w vm.swappiness=10

  • Use lightweight desktop environments or to totally dispense with a graphical environment, whenever possible and the user is comfortable with the text mode, it is a radical solution but one that contributes enormously to performance. If in your case you do not want to give up the benefits of the GUIs, you can opt for a lightweight distro. Remember that any workload that you take away means free resources that can be used for other purposes.
  • And with what I have commented in the previous paragraph to say that it would also be a good idea to stop all those demons from services that we do not use. This not only improves performance, but also safety. The kill command can also be your ally for killing unnecessary processes.
  • If you don't know how to configure SELinux properly better not use it, opt for other security mechanisms. Although it improves security enormously but it is very heavy, and if it is incorrectly configured it may not be worth the huge loss of performance that it could suppose.
  • Always compile software from sourceYou can also use specific compiler flags to optimize the instructions for your specific CPU, which will improve performance.
  • Set up a kernel as light as possible eliminating all those controllers that we do not use so as not to generate an image too large, and if they are secondary, do not mark them so that they are included within the kenel, but as modules. The configuration options related to the CPU that you will find in the config can also optimize the work a lot.
  • Choose a good file system:
    • btrfs: good overall performance, even better than ext4 so it would be the best option.
    • ext4: good overall performance.
    • JFS: It does very little CPU usage, therefore it is an option to consider.
    • XFS: if you handle very large files, such as a database, it would be the best option for its performance. On the other hand, for a normal user it can be detrimental since its performance worsens with small files.
    • ReiserFS: the opposite of the previous one, good performance for small files.
  • I do not advise you to reserve RAM memory spaces and mount some kind of FS there as an alternative to an SSD or load the / tmp there, since it is true that it will improve the access time for that data hosted there but it will also use more the CPU. So avoid this kind of practice or use compcache, etc.
  • There are also performance-enhancing software of our system, so it would be good to use this maintenance software from time to time to help improve performance. For example verynice ... And now that I have written this name I just remembered commands like nice, renice and ionice that can be especially relevant in these cases. We have already talked about them in LxA.
  • There are also Tricks on the net for different programs, if you use any frequently you can look for these tricks to speed them up. For example for Firefox, LibreOffice, SSH, etc.

Do not forget to leave your comments, doubts or suggestions...


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Aaa said

    And why do they want so much performance if they use PCs to play carte blanche and watch Facebook

  2.   Luis said

    In my Lenovo G550 (T4200) it is quite noticeable and I use it for multimedia.

  3.   Luis said

    leaving gentoo