I noticed today that /var/log/dmesg contains several dozen lines with information about something called gran_size and *BAD*gran_size, followed by what appears to be an instruction for me:

[    0.000000] mtrr_cleanup: can not find optimal value
[    0.000000] please specify mtrr_gran_size/mtrr_chunk_size

Do I need to do what it says? How would I?


MTRR stands for Memory Type range registers which is a new way of partitioning and managing memory resources in your system. This feature had been placed in processors due to memory sizes becoming bigger and bigger. There had to be a way that the memory could be allocated addressed and used more effectively.

A main feature of the MTRR is to map locations of PCI or AGP components in your system so that software, drivers could access them quickly and efficiently.

(from Gentoo Wiki)

After reading Solving linux MTRR problems it appears that the error you see is reported when mtrr sanitizer is unable to choose from several options of memory layout. It should print a list of possible options next to the error message. To make the message to go away, you need to specify something like

enable_mtrr_cleanup mtrr_spare_reg_nr=1 mtrr_gran_size=32M mtrr_chunk_size=128M

in the kernal boot parameters (where the actual values come from one of the options proposed by the sanitizer).

The author of the article claims that

Now 24MiB of ram are gone, but my 3d workloads, which are basically webgl content and the hidden flight simulator inside google earth, run both at significant better framerates.

which makes me very interested... need to check dmesg on all my machines.

  • 1
    My computer offers 136 possible selections... how the heck would I know which one would be the best if already the kernel guys couldn't choose?! Sep 25 '20 at 19:07

According to [Redhat's Knowledgebase][1] for RHEL6, updated January 2017, "please specify mtrr_gran_size/mtrr_chunk_size" means:

  • These messages are not a problem and are simply warnings. They can be ignored.
  • Adding disable_mtrr_cleanup disable_mtrr_trim to the kernel parameters in /boot/grub/grub.conf will disable the code path that initiates these errors and can prevent them from appearing on the system.

I'm of course aware that Redhat is not Ubuntu, but by and large they run the same kernel so I'd be very surprised if it's not the same for Ubuntu. This answer is offered as a "second opinion".

[1]: https://access.redhat.com/solutions/2852191 - (subscription required)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.