Ubuntu – How and why should I specify mtrr_gran_size/mtrr_chunk_size


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?

Best Answer

  • 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.

  • Related Question