Advertisement

prev next index

Linux and Memory
Updated March 20, 2002
Created May 22, 2001


Determining if your entire memory is being detected:

Use one of the following commands:
  • Use the "free" command
  • free
  • Check in /proc/meminfo
  • cat /proc/meminfo
  • Use the "dmesg" command
  • dmesg
  • Check what the kernel displays on boot up


  • After the kernel loads, press Shift+PgUp and/or Shift+PgDn to view previous screen messages. The memory messages is at the very beginning of the kernel boot up procedure.

    Note: Once you switch away from a console screen, you may no longer use Shift+PgUp to view previous screen messages. Therefore it may be necessary to prevent the GUI from starting after the kernel loads. This can be accomplished in one of several ways:

    • Enter "Single User Maintenance Mode" (runlevel 1):
    • linux S
    • Enter text mode if installing Linux:
    • linux text

METHOD1 METHOD2 METHOD3


Specifying Undetected Memory - Method #1

Note: For Red Hat 7.1 and above (kernel 2.4.x and above) try Method #3 first.

If your entire memory is not detected automatically, then you can specify memory at the boot: prompt or as an append line in /etc/lilo.conf.

Note: This usually occurs on machines with EISA in them. Machines that do not have any EISA slots usually detect all installed memory.

Note: This method #1 is to be used if you do not see memory above 16MB. If you are having problems trying to see memory over 1GB of memory then please read a different section on this page.

The following format is for use at the boot: prompt:

Red Hat 7.0 and prior
mem=128M

The following format is for use as part of an append statement in /etc/lilo.conf:

Red Hat 7.0 and prior
append="mem=128M"


METHOD1 METHOD2 METHOD3


Specifying Undetected Memory - Method #2

Note: For Red Hat 7.1 and above (kernel 2.4.x and above) try Method #3 first.

On servers that don't detect above 16MB, here is an alternate method that may work as well as Method #1:
mem=exactmap mem=0x9f000@0 mem=0x13f00000@0x100000
I translated the above values here for easier reading:
0x9f000 = 651264 bytes = 636k
0xA0000 = 655360 bytes = 640k
0x13f00000 = 334495744 bytes = 326656k = 319M
0x14000000 = 335544320 bytes = 327680k = 320M
0x100000 = 1048576 bytes = 1024k = 1M
"mem=0x9f000@0" will set up the lower 640k.
"mem=0x13f00000@0x100000" will set up from 1M to 320M

As far as I can tell, the above states to start at 1M and go out 319M. This will give you a total of 319M + the lower 640k

The above values will work (as shown if you have 320M), but I will need to double check exactly how much memory is being detected by using this method.

It appears that the method to calculate a value is to take your mem in MB, multiply by 1024, multiply by 1024, then convert to hex, then subtract 0x100000.

Here's an example:
For 128M:

128       *   1024     = 131072
131072    *   1024     = 134217728
134217728 ->  Hex      = 0x8000000
0x8000000 -   0x100000 = 0x7F00000
Then you would use:
mem=exactmap mem=0x9f000@0 mem=0x7f00000@0x100000
For 256M:

256M         *   1024     = 262144
262144       *   1024     = 268435456
268435456    ->  Hex      = 0x10000000
0x10000000   -   0x100000 = 0xFF00000
Then you would use:
mem=exactmap mem=0x9f000@0 mem=0xff00000@0x100000
The other method that should arrive at the same number is to take your mem in MB, subtract 1MB, multiply by 1024, multiply by 1024, then convert to hex.
256M       -   1     = 255
255        *   1024  = 261120
261120     *   1024  = 267386880
267386880  ->  Hex   = 0xFF00000
Here are some samples using Method #2:
16M: linux mem=exactmap mem=0x9f000@0 mem=0x0f00000@0x100000
32M: linux mem=exactmap mem=0x9f000@0 mem=0x1f00000@0x100000
48M: linux mem=exactmap mem=0x9f000@0 mem=0x2f00000@0x100000
64M: linux mem=exactmap mem=0x9f000@0 mem=0x3f00000@0x100000
80M: linux mem=exactmap mem=0x9f000@0 mem=0x4f00000@0x100000
96M: linux mem=exactmap mem=0x9f000@0 mem=0x5f00000@0x100000
112M: linux mem=exactmap mem=0x9f000@0 mem=0x6f00000@0x100000
128M: linux mem=exactmap mem=0x9f000@0 mem=0x7f00000@0x100000
144M: linux mem=exactmap mem=0x9f000@0 mem=0x8f00000@0x100000
160M: linux mem=exactmap mem=0x9f000@0 mem=0x9f00000@0x100000
176M: linux mem=exactmap mem=0x9f000@0 mem=0xaf00000@0x100000
192M: linux mem=exactmap mem=0x9f000@0 mem=0xbf00000@0x100000
208M: linux mem=exactmap mem=0x9f000@0 mem=0xcf00000@0x100000
224M: linux mem=exactmap mem=0x9f000@0 mem=0xdf00000@0x100000
240M: linux mem=exactmap mem=0x9f000@0 mem=0xef00000@0x100000
256M: linux mem=exactmap mem=0x9f000@0 mem=0xff00000@0x100000
512M: linux mem=exactmap mem=0x9f000@0 mem=0x1ff00000@0x100000

METHOD1 METHOD2 METHOD3


Specifying Undetected Memory - Method #3

This is basically method #2, but in a more readable format.

For a machine with 48M of memory you would use the following:
linux mem=exactmap mem=640K@0 mem=47M@1M
96M
linux mem=exactmap mem=640K@0 mem=95M@1M
128M
linux mem=exactmap mem=640K@0 mem=127M@1M
256M
linux mem=exactmap mem=640K@0 mem=255M@1M
Read Method #2 if you need a better understanding of how this memory command works.

Thanks to NKJensen, Denmark for helping us out with this one!

NKJensen, Denmark also found the following properties about using this method in /etc/lilo.conf:
  • If you put the "append=" line in the global section of /etc/lilo.conf (the section at the very top of /etc/lilo.conf before the individual boot images), it will apply to all boot images in /etc/lilo.conf.


  • A space seems to be required at the beginning of the quotes of the append line:
  • append=" mem=exactmap mem=640K@0 mem=95M@1M"
    
  • As always don't forget to run /sbin/lilo once you finish making changes to /etc/lilo.conf.
Here are some samples using Method #3:
32M: linux mem=exactmap mem=640K@0 mem=31M@1M
48M: linux mem=exactmap mem=640K@0 mem=47M@1M
64M: linux mem=exactmap mem=640K@0 mem=63M@1M
96M: linux mem=exactmap mem=640K@0 mem=95M@1M
128M: linux mem=exactmap mem=640K@0 mem=127M@1M
256M: linux mem=exactmap mem=640K@0 mem=255M@1M
512M: linux mem=exactmap mem=640K@0 mem=511M@1M


Installing with more than 1GB of memory:

It is not wise to have the installer use more than 1GB of memory. The installer may not be configured to handle it and may get confused and abort. Limit the amount of memory that the installer sees to 960M. The following may be keyed in at the boot prompt:
mem=960M


Gaining access to more than 1GB of memory:

If your system isn't detecting more than 1GB of memory then there are several ways to get around this:
  • Install the Enterprise-kernel - this has support for more memory built in already
  • Recompile the kernel choosing either 1GB, 2GB or 4GB during configuration
  • Recompile the kernel enabling bigmem


Linux Kernel 2.4 Notes

Here are some excerpts from the file: arch/i386/kernel/setup.c
459-474:
/*
 * Copy the BIOS e820 map into a safe place.
 *
 * Sanity-check it while we're at it..
 *
 * If we're lucky and live on a modern system, the setup code
 * will have given us a memory map that we can use to properly
 * set up memory.  If we aren't, we'll fake a memory map.
 *
 * We check to see that the memory map contains at least 2 elements
 * before we'll use it, because the detection code in setup.S may
 * not be perfect and most every PC known to man has two memory
 * regions: one from 0 to 640k, and one from 1mb up.  (The IBM
 * thinkpad 560x, for example, does not cooperate with the memory
 * detection code.)
 */

520-525:
	/*
	 * Try to copy the BIOS-supplied E820-map.
	 *
	 * Otherwise fake a memory map; one section from 0k->640k,
	 * the next section from 1mb->appropriate_mem_k
	 */

558-564:
		/*
		 * "mem=nopentium" disables the 4MB page tables.
		 * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
		 * to <mem>, overriding the bios size.
		 * "mem=XXX[KkmM]@XXX[KkmM]" defines a memory region from
		 * <start> to <start>+<mem>, overriding the bios size.
		 */

577-582:
				/* If the user specifies memory size, we
				 * limit the BIOS-provided memory map to
				 * that size. exactmap can be used to specify
				 * the exact map. mem=number can be used to
				 * trim the existing memory map.
				 */

prev next index
NEW! Search this Site!: