提交 492ef00f 编写于 作者: A Amadeusz Sławiński 提交者: Zheng Zengkai

PM: hibernate: Remove register_nosave_region_late()

stable inclusion
from stable-v5.10.101
commit 4607218fde84a76973d3941999360360ff6e333a
bugzilla: https://gitee.com/openeuler/kernel/issues/I5669Z

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4607218fde84a76973d3941999360360ff6e333a

--------------------------------

[ Upstream commit 33569ef3 ]

It is an unused wrapper forcing kmalloc allocation for registering
nosave regions. Also, rename __register_nosave_region() to
register_nosave_region() now that there is no need for disambiguation.
Signed-off-by: NAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: NCezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 2cda0e11
...@@ -430,15 +430,7 @@ struct platform_hibernation_ops { ...@@ -430,15 +430,7 @@ struct platform_hibernation_ops {
#ifdef CONFIG_HIBERNATION #ifdef CONFIG_HIBERNATION
/* kernel/power/snapshot.c */ /* kernel/power/snapshot.c */
extern void __register_nosave_region(unsigned long b, unsigned long e, int km); extern void register_nosave_region(unsigned long b, unsigned long e);
static inline void __init register_nosave_region(unsigned long b, unsigned long e)
{
__register_nosave_region(b, e, 0);
}
static inline void __init register_nosave_region_late(unsigned long b, unsigned long e)
{
__register_nosave_region(b, e, 1);
}
extern int swsusp_page_is_forbidden(struct page *); extern int swsusp_page_is_forbidden(struct page *);
extern void swsusp_set_page_free(struct page *); extern void swsusp_set_page_free(struct page *);
extern void swsusp_unset_page_free(struct page *); extern void swsusp_unset_page_free(struct page *);
...@@ -457,7 +449,6 @@ int pfn_is_nosave(unsigned long pfn); ...@@ -457,7 +449,6 @@ int pfn_is_nosave(unsigned long pfn);
int hibernate_quiet_exec(int (*func)(void *data), void *data); int hibernate_quiet_exec(int (*func)(void *data), void *data);
#else /* CONFIG_HIBERNATION */ #else /* CONFIG_HIBERNATION */
static inline void register_nosave_region(unsigned long b, unsigned long e) {} static inline void register_nosave_region(unsigned long b, unsigned long e) {}
static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
static inline void swsusp_set_page_free(struct page *p) {} static inline void swsusp_set_page_free(struct page *p) {}
static inline void swsusp_unset_page_free(struct page *p) {} static inline void swsusp_unset_page_free(struct page *p) {}
......
...@@ -944,8 +944,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm) ...@@ -944,8 +944,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm)
* Register a range of page frames the contents of which should not be saved * Register a range of page frames the contents of which should not be saved
* during hibernation (to be used in the early initialization code). * during hibernation (to be used in the early initialization code).
*/ */
void __init __register_nosave_region(unsigned long start_pfn, void __init register_nosave_region(unsigned long start_pfn, unsigned long end_pfn)
unsigned long end_pfn, int use_kmalloc)
{ {
struct nosave_region *region; struct nosave_region *region;
...@@ -961,18 +960,12 @@ void __init __register_nosave_region(unsigned long start_pfn, ...@@ -961,18 +960,12 @@ void __init __register_nosave_region(unsigned long start_pfn,
goto Report; goto Report;
} }
} }
if (use_kmalloc) { /* This allocation cannot fail */
/* During init, this shouldn't fail */ region = memblock_alloc(sizeof(struct nosave_region),
region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL); SMP_CACHE_BYTES);
BUG_ON(!region); if (!region)
} else { panic("%s: Failed to allocate %zu bytes\n", __func__,
/* This allocation cannot fail */ sizeof(struct nosave_region));
region = memblock_alloc(sizeof(struct nosave_region),
SMP_CACHE_BYTES);
if (!region)
panic("%s: Failed to allocate %zu bytes\n", __func__,
sizeof(struct nosave_region));
}
region->start_pfn = start_pfn; region->start_pfn = start_pfn;
region->end_pfn = end_pfn; region->end_pfn = end_pfn;
list_add_tail(&region->list, &nosave_regions); list_add_tail(&region->list, &nosave_regions);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册