mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
mm: make physical memory offline work
In recent versions, the platform specific physical offline returns the number of bytes offlined, so a value of 0 indicates an error, not success as in older versions. Make sure that the memory for the original memory resource nodes is not freed via kfree, as this memory was obtained from alloc_bootmem very early in the system's life. Change-Id: Iffcdd8be4483e043d7605fce596ed438b15f3e02 Signed-off-by: Larry Bassel <lbassel@codeaurora.org> (cherry picked from commit 2421717cb10a06814d7bdb431485aa3a5e364f36)
This commit is contained in:
parent
e188e3e5cb
commit
17dfb1cddc
1 changed files with 8 additions and 4 deletions
|
@ -1179,9 +1179,9 @@ int __ref physical_remove_memory(u64 start, u64 size)
|
|||
BUG_ON(!res);
|
||||
|
||||
ret = arch_physical_remove_memory(start, size);
|
||||
if (ret) {
|
||||
if (!ret) {
|
||||
kfree(res);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
res->name = "System RAM";
|
||||
|
@ -1190,8 +1190,11 @@ int __ref physical_remove_memory(u64 start, u64 size)
|
|||
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
|
||||
|
||||
res_old = locate_resource(&iomem_resource, res);
|
||||
if (res_old)
|
||||
release_memory_resource(res_old);
|
||||
if (res_old) {
|
||||
release_resource(res_old);
|
||||
if (PageSlab(virt_to_head_page(res_old)))
|
||||
kfree(res_old);
|
||||
}
|
||||
kfree(res);
|
||||
|
||||
return ret;
|
||||
|
@ -1946,6 +1949,7 @@ repeat:
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue