]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: 6890/1: memmap: only free allocated memmap entries when using SPARSEMEM
authorWill Deacon <will.deacon@arm.com>
Thu, 28 Apr 2011 17:44:31 +0000 (18:44 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 12 May 2011 09:52:00 +0000 (10:52 +0100)
commita0ba0d98194fdd2db3ef4d2d691cf7fefa9d96f4
treeb884faac285aeb76c07f73e118ef29ce94cd7156
parent8e9f5985190638d2e670af9451af1f2381608be0
ARM: 6890/1: memmap: only free allocated memmap entries when using SPARSEMEM

The SPARSEMEM code allocates memmap entries only for sections which are
present (i.e. those which contain some valid memory). The membank checks
in free_unused_memmap do not take this into account and can incorrectly
attempt to free memory which is not allocated, resulting in a BUG() in
the bootmem code.

However, if memory is configured as follows:

    |<----section---->|<----hole---->|<----section---->|
    +--------+--------+--------------+--------+--------+
    | bank 0 | unused |              | bank 1 | unused |
    +--------+--------+--------------+--------+--------+

where a bank only occupies part of a section, the memmap allocated for
the remainder of the section *can* be freed.

This patch modifies the checks in free_unused_memmap so that only valid
memmap entries are considered for removal.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/init.c