Re: Early memory patch, revised

From: Eric W. Biederman
Date: Thu Feb 26 2004 - 01:27:08 EST


"H. Peter Anvin" <hpa@xxxxxxxxx> writes:
> Hi all,

While looking and understanding what this code does I have found
a real bug.

> +/*
> + * This is how much memory *in addition to the memory covered up to
> + * and including _end* we need mapped initially. We need one bit for
> + * each possible page, which currently means 2^36/4096/8 = 2 MB
> + * (64-bit-capable chips can do more, but if you have more than 64 GB
> + * of memory you *really* should be running a 64-bit kernel. However,
> + * if this really bothers someone we could query this dynamically.)
> + *
> + * The other thing we may want to do dynamically in the future is to
> + * detect PSE and skip generating the PTEs.
> + *
> + * Modulo rounding, each megabyte assigned here requires a kilobyte of
> + * memory, which is currently unreclaimed.
> + *
> + * This should be a multiple of a page.
> */

The comment about the bootmem is wrong and misleading. The bootmem
bitmap only included low memory. So in the worst case with a 4G/4G split
it can be 2^32/4096/8 = 128KiB. Normally the worst case is only 32KiB with
a 3G/1G split.

> +#define INIT_MAP_BEYOND_END (2*1024*1024)

#define INIT_MAP_BEYOND_END (128*1024)
is the correct value here.

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/