DMM: Fix for movable bytes near end of address space

To prevent overflow near 4GB memory address, the rounding down of
memory addresses needs to be propagated to the memory hotplug logic.
Checking if a given pfn is part of physical ram allows us to do this.
Also while walking through system ram, we need to take care of
overflow at high memory address.

Change-Id: Id962cf93906888783a807fe89f2be4ba91b2c5d6
Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>
(cherry picked from commit 28976a80e961f491e51c1cb627311efc4981b69a)

Conflicts:

	drivers/base/memory.c
This commit is contained in:
Hanumant Singh 2012-04-18 14:14:21 -07:00 committed by Stephen Boyd
parent c8921c51d8
commit 8c04289245

View File

@ -402,12 +402,18 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
while ((res.start < res.end) &&
(find_next_system_ram(&res, "System RAM") >= 0)) {
pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT;
end_pfn = (res.end + 1) >> PAGE_SHIFT;
if (res.end + 1 <= 0)
end_pfn = res.end >> PAGE_SHIFT;
else
end_pfn = (res.end + 1) >> PAGE_SHIFT;
if (end_pfn > pfn)
ret = (*func)(pfn, end_pfn - pfn, arg);
if (ret)
break;
res.start = res.end + 1;
if (res.end + 1 > res.start)
res.start = res.end + 1;
else
res.start = res.end;
res.end = orig_end;
}
return ret;