{
    "content": [
        {
            "type": "text",
            "text": "# chmem(8) (man)\n\n**Summary:** chmem - configure memory\n\n**Synopsis:** chmem [-h] [-V*] [-v] [-e|-d] [SIZE|RANGE -b BLOCKRANGE] [-z ZONE]\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -b | --blocks | — | Use a BLOCKRANGE parameter instead of RANGE or SIZE for the --enable and --disable options. |\n| -d | --disable | — | Set the specified RANGE, SIZE, or BLOCKRANGE of memory offline. |\n| -e | --enable | — | Set the specified RANGE, SIZE, or BLOCKRANGE of memory online. |\n| -z | --zone | — | Select the memory ZONE where to set the specified RANGE, SIZE, or BLOCKRANGE of memory online or offline. By default, me |\n| -h | --help | — | Print a short help text, then exit. |\n| -v | --verbose | — | Verbose mode. Causes chmem to print debugging messages about it’s progress. |\n| -V | --version | — | Print the version number, then exit. |\n\n## Examples\n\n- `This command requests 1024 MiB of memory to be set online.`\n- `This command requests 2 GiB of memory to be set online.`\n- `This command requests the memory range starting with 0x00000000e4000000 and ending with`\n- `0x00000000f3ffffff to be set offline.`\n- `This command requests the memory block number 10 to be set offline.`\n\n## See Also\n\n- lsmem(1)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (38 lines)\n- **OPTIONS** (1 lines) — 7 subsections\n  - -b --blocks (3 lines)\n  - -d --disable (2 lines)\n  - -e --enable (2 lines)\n  - -z --zone (4 lines)\n  - -h --help (2 lines)\n  - -v --verbose (2 lines)\n  - -V --version (2 lines)\n- **EXIT STATUS** (11 lines)\n- **EXAMPLE** (1 lines) — 4 subsections\n  - chmem --enable 1024 (2 lines)\n  - chmem -e 2g (2 lines)\n  - chmem --disable 0x00000000e4000000-0x00000000f3ffffff (3 lines)\n  - chmem -b -d 10 (2 lines)\n- **SEE ALSO** (2 lines)\n- **REPORTING BUGS** (2 lines)\n- **AVAILABILITY** (6 lines)\n\n## Full Content\n\n### NAME\n\nchmem - configure memory\n\n### SYNOPSIS\n\nchmem [-h] [-V*] [-v] [-e|-d] [SIZE|RANGE -b BLOCKRANGE] [-z ZONE]\n\n### DESCRIPTION\n\nThe chmem command sets a particular size or range of memory online or offline.\n\n•   Specify SIZE as <size>[m|M|g|G]. With m or M, <size> specifies the memory size in MiB\n(1024 x 1024 bytes). With g or G, <size> specifies the memory size in GiB (1024 x 1024 x\n1024 bytes). The default unit is MiB.\n\n•   Specify RANGE in the form 0x<start>-0x<end> as shown in the output of the lsmem(1)\ncommand. <start> is the hexadecimal address of the first byte and <end> is the\nhexadecimal address of the last byte in the memory range.\n\n•   Specify BLOCKRANGE in the form <first>-<last> or <block> as shown in the output of the\nlsmem(1) command. <first> is the number of the first memory block and <last> is the\nnumber of the last memory block in the memory range. Alternatively a single block can be\nspecified. BLOCKRANGE requires the --blocks option.\n\n•   Specify ZONE as the name of a memory zone, as shown in the output of the lsmem -o +ZONES\ncommand. The output shows one or more valid memory zones for each memory range. If\nmultiple zones are shown, then the memory range currently belongs to the first zone. By\ndefault, chmem will set memory online to the zone Movable, if this is among the valid\nzones. This default can be changed by specifying the --zone option with another valid\nzone. For memory ballooning, it is recommended to select the zone Movable for memory\nonline and offline, if possible. Memory in this zone is much more likely to be able to be\nofflined again, but it cannot be used for arbitrary kernel allocations, only for\nmigratable pages (e.g., anonymous and page cache pages). Use the --help option to see all\navailable zones.\n\nSIZE and RANGE must be aligned to the Linux memory block size, as shown in the output of the\nlsmem(1) command.\n\nSetting memory online can fail for various reasons. On virtualized systems it can fail if the\nhypervisor does not have enough memory left, for example because memory was overcommitted.\nSetting memory offline can fail if Linux cannot free the memory. If only part of the\nrequested memory can be set online or offline, a message tells you how much memory was set\nonline or offline instead of the requested amount.\n\nWhen setting memory online chmem starts with the lowest memory block numbers. When setting\nmemory offline chmem starts with the highest memory block numbers.\n\n### OPTIONS\n\n#### -b --blocks\n\nUse a BLOCKRANGE parameter instead of RANGE or SIZE for the --enable and --disable\noptions.\n\n#### -d --disable\n\nSet the specified RANGE, SIZE, or BLOCKRANGE of memory offline.\n\n#### -e --enable\n\nSet the specified RANGE, SIZE, or BLOCKRANGE of memory online.\n\n#### -z --zone\n\nSelect the memory ZONE where to set the specified RANGE, SIZE, or BLOCKRANGE of memory\nonline or offline. By default, memory will be set online to the zone Movable, if\npossible.\n\n#### -h --help\n\nPrint a short help text, then exit.\n\n#### -v --verbose\n\nVerbose mode. Causes chmem to print debugging messages about it’s progress.\n\n#### -V --version\n\nPrint the version number, then exit.\n\n### EXIT STATUS\n\nchmem has the following exit status values:\n\n0\nsuccess\n\n1\nfailure\n\n64\npartial success\n\n### EXAMPLE\n\n#### chmem --enable 1024\n\nThis command requests 1024 MiB of memory to be set online.\n\n#### chmem -e 2g\n\nThis command requests 2 GiB of memory to be set online.\n\n#### chmem --disable 0x00000000e4000000-0x00000000f3ffffff\n\nThis command requests the memory range starting with 0x00000000e4000000 and ending with\n0x00000000f3ffffff to be set offline.\n\n#### chmem -b -d 10\n\nThis command requests the memory block number 10 to be set offline.\n\n### SEE ALSO\n\nlsmem(1)\n\n### REPORTING BUGS\n\nFor bug reports, use the issue tracker at https://github.com/karelzak/util-linux/issues.\n\n### AVAILABILITY\n\nThe chmem command is part of the util-linux package which can be downloaded from Linux Kernel\nArchive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\n\n\nutil-linux 2.37.2                            2021-06-02                                     CHMEM(8)\n\n"
        }
    ],
    "structuredContent": {
        "command": "chmem",
        "section": "8",
        "mode": "man",
        "summary": "chmem - configure memory",
        "synopsis": "chmem [-h] [-V*] [-v] [-e|-d] [SIZE|RANGE -b BLOCKRANGE] [-z ZONE]",
        "flags": [
            {
                "flag": "-b",
                "long": "--blocks",
                "arg": null,
                "description": "Use a BLOCKRANGE parameter instead of RANGE or SIZE for the --enable and --disable options."
            },
            {
                "flag": "-d",
                "long": "--disable",
                "arg": null,
                "description": "Set the specified RANGE, SIZE, or BLOCKRANGE of memory offline."
            },
            {
                "flag": "-e",
                "long": "--enable",
                "arg": null,
                "description": "Set the specified RANGE, SIZE, or BLOCKRANGE of memory online."
            },
            {
                "flag": "-z",
                "long": "--zone",
                "arg": null,
                "description": "Select the memory ZONE where to set the specified RANGE, SIZE, or BLOCKRANGE of memory online or offline. By default, memory will be set online to the zone Movable, if possible."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Print a short help text, then exit."
            },
            {
                "flag": "-v",
                "long": "--verbose",
                "arg": null,
                "description": "Verbose mode. Causes chmem to print debugging messages about it’s progress."
            },
            {
                "flag": "-V",
                "long": "--version",
                "arg": null,
                "description": "Print the version number, then exit."
            }
        ],
        "examples": [
            "This command requests 1024 MiB of memory to be set online.",
            "This command requests 2 GiB of memory to be set online.",
            "This command requests the memory range starting with 0x00000000e4000000 and ending with",
            "0x00000000f3ffffff to be set offline.",
            "This command requests the memory block number 10 to be set offline."
        ],
        "see_also": [
            {
                "name": "lsmem",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/lsmem/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 38,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-b --blocks",
                        "lines": 3,
                        "flag": "-b",
                        "long": "--blocks"
                    },
                    {
                        "name": "-d --disable",
                        "lines": 2,
                        "flag": "-d",
                        "long": "--disable"
                    },
                    {
                        "name": "-e --enable",
                        "lines": 2,
                        "flag": "-e",
                        "long": "--enable"
                    },
                    {
                        "name": "-z --zone",
                        "lines": 4,
                        "flag": "-z",
                        "long": "--zone"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-v --verbose",
                        "lines": 2,
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "-V --version",
                        "lines": 2,
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "EXIT STATUS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "EXAMPLE",
                "lines": 1,
                "subsections": [
                    {
                        "name": "chmem --enable 1024",
                        "lines": 2
                    },
                    {
                        "name": "chmem -e 2g",
                        "lines": 2
                    },
                    {
                        "name": "chmem --disable 0x00000000e4000000-0x00000000f3ffffff",
                        "lines": 3
                    },
                    {
                        "name": "chmem -b -d 10",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 6,
                "subsections": []
            }
        ]
    }
}