From 8a57f81411e6c1fd5c80fa42ee2bd44246e3460a Mon Sep 17 00:00:00 2001 From: Larry Bassel Date: Fri, 22 Jan 2010 10:54:18 -0800 Subject: [PATCH] mm: add support for putting memory in a low-power state The file /sys/devices/system/memory/low_power now exists. Writing a physical address into this file will put this section of memory into a low power state (retaining contents) if the architecture and platform supports it. Change-Id: I70592d37f1091a1b533f2374546ba67b50ea7d30 Signed-off-by: Larry Bassel (cherry picked from commit 1f4d1c8e295aaf66b23309caa0d03b09b7009b99) Conflicts: drivers/base/memory.c include/linux/memory_hotplug.h --- include/linux/memory_hotplug.h | 3 +++ mm/memory_hotplug.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index e04364ed9c0c..41f7595b4f77 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -260,3 +260,6 @@ extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, #endif /* __LINUX_MEMORY_HOTPLUG_H */ extern int physical_remove_memory(u64 start, u64 size); +extern int arch_physical_remove_memory(u64 start, u64 size); +extern int physical_low_power_memory(u64 start, u64 size); +extern int arch_physical_low_power_memory(u64 start, u64 size); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 25e02b6bb46f..77eaf2c61336 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1199,6 +1199,16 @@ int __ref physical_remove_memory(u64 start, u64 size) } EXPORT_SYMBOL_GPL(physical_remove_memory); +int __ref physical_low_power_memory(u64 start, u64 size) +{ + int ret; + + /* call arch's memory low power routine */ + ret = arch_physical_low_power_memory(start, size); + return ret; +} +EXPORT_SYMBOL_GPL(physical_low_power_memory); + #ifdef CONFIG_MEMORY_HOTREMOVE /* * A free page on the buddy free lists (not the per-cpu lists) has PageBuddy