From f37b6d79f8d8c221b5da3724f300b089d1c00e60 Mon Sep 17 00:00:00 2001 From: Patrick Daly Date: Wed, 8 Dec 2021 21:29:03 -0800 Subject: [PATCH] ANDROID: mm/memory_hotplug: Don't special case memory_block_size_bytes If add_memory_subsection() is called with a size of memory_block_size_bytes, it calls into add_memory(), which declares the region as system ram, and adds it to the buddy allocator. This is inconsistent with the behavior of add_memory_subsection() for other sizes, for which it does not add the memory to buddy and instead reserves it for the caller's private use. Bug: 210008865 Fixes: 417ac617ea5e ("ANDROID: mm/memory_hotplug: implement {add/remove}_memory_subsection") Change-Id: Iefb69b0b4e96af670d0e65c325a9538d14b460e3 Signed-off-by: Patrick Daly --- mm/memory_hotplug.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 41ac69bc0299..21066576ee45 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1136,9 +1136,6 @@ int add_memory_subsection(int nid, u64 start, u64 size) struct resource *res; int ret; - if (size == memory_block_size_bytes()) - return add_memory(nid, start, size, MHP_NONE); - if (!IS_ALIGNED(start, SUBSECTION_SIZE) || !IS_ALIGNED(size, SUBSECTION_SIZE)) { pr_err("%s: start 0x%llx size 0x%llx not aligned to subsection size\n", @@ -1837,9 +1834,6 @@ EXPORT_SYMBOL_GPL(remove_memory); int remove_memory_subsection(int nid, u64 start, u64 size) { - if (size == memory_block_size_bytes()) - return remove_memory(nid, start, size); - if (!IS_ALIGNED(start, SUBSECTION_SIZE) || !IS_ALIGNED(size, SUBSECTION_SIZE)) { pr_err("%s: start 0x%llx size 0x%llx not aligned to subsection size\n",