Change the size of my memory pages?

19,483

Solution 1

You probably want to look at Transparent Hugepages. The .config item is CONFIG_TRANSPARENT_HUGEPAGE. Note that enabling this won't give you huge pages automatically. You'll need to set the CONFIG_TRANSPARENT_HUGEPAGE_MADVISE to 'n', in order to make it the default.

Also note that this doesn't allow you to choose an arbitrary page size. I allows to use the huge page size of the architecture. For x86_64 this is 1Mb, see https://en.wikipedia.org/wiki/Page_(computer_memory)#Huge_pages for the full table.

Solution 2

The PAGESIZE is set at kernel compile time. That selection is only valid for i386 hardware. If you run a 64-bit system or any other architecture, the page size is 4K and cannot be changed.

Solution 3

Slabs seem to be an exact solution you are just looking for. Slabs are memory units pre-allocated by kernel and should more or less avoid the allocation overhead, which seems just what you are trying to reach.

For more information, see Wikipedia: Slab allocation

Changing page size (if it was possible) to an amount of 1MiB would cause excessive memory waste. Many (I mean dozens of) subprocesses and daemons take up just few kB of memory. Is any memory that cheap?

Share:
19,483

Related videos on Youtube

qdii
Author by

qdii

Updated on September 18, 2022

Comments

  • qdii
    qdii over 1 year

    I would like to change my kernel's page size from 4KB to 4MB as I have had a large addition of RAM to my computer and I am never running out of anymore.

    The idea is that programs requiring large amounts of memory will spend less time on allocating pages. I suppose it would improve performance, and I would like to try.

    I can’t find anywhere when running make menuconfig. Is there a way to do that?

  • Mark Stewart
    Mark Stewart almost 8 years
    To verify PAGE_SIZE you can use the command getconf PAGE_SIZE
  • Patrick Vickery
    Patrick Vickery almost 3 years
    Even if there were a hundred or more of these sub-processes running, 200MB of RAM isn't that much for someone with 16GB, it's not like I ever come close to maxing that out(I don't game on this machine). Not that I think you'd necessarily see a lot of performance gains from using huge pages.