Previous page

Next page

Locate page in Contents

Print this page

Customizing /proc/meminfo Output Inside Container

The /proc/meminfo virtual file allows you to view the information about memory usage (both physical and swap) on the system. In the current version of Parallels Server Bare Metal, you can customize the output of this file inside a particular Container and set it to one of the following modes:

  • Non-virtualized . In this case running the cat /proc/meminfo command inside a Container will display the information about the physical memory on the server (total, used, free, shared, etc.), in kilobytes.
  • Virtualized in pages . Setting the /proc/meminfo output to this mode allows you to specify what amount of total memory (in kilobytes) will be displayed while running the cat /proc/meminfo command inside this or that Container.
  • Virtualized in privvmpages . Setting the /proc/meminfo output to this mode also allows you to arbitrarily specify the amount of total memory (in kilobytes) to be displayed while running the cat /proc/meminfo command inside this or that Container. As distinct from the previous mode, the amount of memory to be shown in this mode is calculated on the basis of the value of the PRIVVMPAGES parameter set in the Container configuration file.

Notes:

1. Enabling this or that mode for a Container does not exert any influence on the real resources allocation to the Container. It is only used to modify the way the /proc/meminfo output will look inside this Container.

2. The output of the /proc/meminfo file cannot be customized if the new SLM functionality is enabled on the Parallels server. In this case, the cat /proc/meminfo command executed inside a Container always displays the amount of memory set for this Container using the --slmmemorylimit option of the pctl set command.

During the Parallels Server Bare Metal installation, the output of the /proc/meminfo virtual file is set to the ' non-virtualized' mode, i.e. running the cat /proc/meminfo command inside any Container will show the information about the memory usage on the Parallels server. You can use the --meminfo option with the pctl set command to switch between different modes:

  • To set the output of /proc/meminfo inside Container 101 to the ' virtualized in pages ' mode, issue the following command:

    # pctl set 101 --meminfo pages:2000 --save

    The amount of memory that will be displayed by running the cat /proc/meminfo command inside Container 101 is defined by the data specified after the --meminfo option:

    • pages tells the pctl set command that you wish to enable the ' virtualized in pages ' mode for the /proc/meminfo output and simultaneously denotes the units of measurement to be used for setting the amount of memory (e.g. 4-Kb pages for Containers running 32-bit operating systems).
    • 200 denotes the number of pages to be shown in the /proc/meminfo output.

    In our case the /proc/meminfo output inside Container 101 may look like the following:

    # pctl exec 101 cat /proc/meminfo

    MemTotal: 8000 kB

    MemFree: 5140 kB

    LowTotal: 8000 kB

    LowFree: 5140 kB

    Buffers: 0 kB

    Cached: 0 kB

    SwapCached: 0 kB

    HighTotal: 0 kB

    HighFree: 0 kB

    ...

    When working in this mode, keep in mind the following:

    • The specified amount of memory (in our case it is 8000 Kb) is always shown in the MemTotal and LowTotal fields of the cat /proc/meminfo output.
    • The values in the MemFree and LowFree fields are calculated automatically by the system.
    • All the other fields in the command output have the values set to 0.
  • To set the output of /proc/meminfo inside Container 101 to the ' virtualized in privvmpages ' mode, execute the following command:

    # pctl set 101 --meminfo privvmpages:3 --save

    The amount of memory that will be displayed by running the cat /proc/meminfo command inside Container 101 is calculated using the following formulas:

    • Privvmpages_Value * 3 * 4Kb if Container 101 is running a 32-bit operating system (OS) or an OS for x86-64 processors and
    • Privvmpages_Value * 3 * 16Kb if Container 101 is running an OS for IA-64 processors

    where Privvmpages_Value denotes the value of the PRIVVMPAGES parameter set in the Container configuration file and 3 is an arbitrary integer coefficient which you can modify to increase/decrease the amount of memory in the /proc/meminfo output. Assuming that the privvmpages parameter for Container 101 is set to 10000, your output may look as follows:

    # pctl exec 101 cat /proc/meminfo

    MemTotal: 120000 kB

    MemFree: 78248 kB

    LowTotal: 120000 kB

    LowFree: 78248 kB

    Buffers: 0 kB

    Cached: 0 kB

    SwapCached: 0 kB

    HighTotal: 0 kB

    HighFree: 0 kB

    ...

    As can be seen from the example above, the displayed records comply with the same rules as the records in the ' virtualized in pages ' mode.

  • To revert the output of /proc/meminfo to the default mode, execute the following command:

    # pctl set 101 --meminfo none --save

Note: If the value specified after the --meminfo option exceeds the total amount of memory available on the Parallels server, the cat /proc/meminfo command executed inside a Container will display the information about the total physical memory on this server.

The --save flag in the commands above saves all the parameters to the Container configuration file. If you do not want the applied changes to persist, you can omit the --save option and the applied changes will be valid only till the Container shutdown.