Merge branches 'pm-sleep', 'pm-powercap' and 'pm-tools'
Merge updates related to system sleep support, two updates of the intel_rapl power capping driver, and a pm-graph utility fix for 7.2-rc1: - Add sysctl interface for DPM watchdog timeouts (Tzung-Bi Shih) - Use complete() instead of complete_all() in device_pm_sleep_init() to avoid a false-positive warning from lockdep_assert_RT_in_threaded_ctx() when CONFIG_PROVE_RAW_LOCK_NESTING is enabled (Jiakai Xu) - Use a flexible array for CRC uncompressed buffers during hibernation image saving (Rosen Penev) - Make the LZ4 algorithm available for hibernation compression (l1rox3) - Move the preallocate_image() call during hibernation after the "prepare" phase of the "freeze" transition (Matthew Leach) - Fix a memory leak in rapl_add_package_cpuslocked() in the intel_rapl power capping driver and use sysfs_emit() in cpumask_show() in that driver (Sumeet Pawnikar, Yury Norov) - Fix ValueError when parsing incomplete device properties in the pm-graph utility (Gongwei Li) * pm-sleep: PM: dpm_watchdog: Add sysctl interface for DPM watchdog timeouts PM: hibernate: Use flexible array for CRC uncompressed buffers PM: hibernate: make LZ4 available for hibernation compression PM: sleep: Use complete() in device_pm_sleep_init() PM: hibernate: call preallocate_image() after freeze prepare * pm-powercap: powercap: intel_rapl: Use sysfs_emit() in cpumask_show() powercap: intel_rapl: Fix memory leak in rapl_add_package_cpuslocked() * pm-tools: PM: tools: pm-graph: fix ValueError when parsing incomplete device properties
This commit is contained in:
commit
5ca48f6f2a
6 files changed
+79
-55
No files matched your search
@@ -42,6 +42,7 @@ config HIBERNATION
|
||||
select CRC32
|
||||
select CRYPTO
|
||||
select CRYPTO_LZO
|
||||
select CRYPTO_LZ4
|
||||
help
|
||||
Enable the suspend to disk (STD) functionality, which is usually
|
||||
called "hibernation" in user interfaces. STD checkpoints the
|
||||
|
||||
@@ -392,23 +392,6 @@ static int create_image(int platform_mode)
|
||||
return error;
|
||||
}
|
||||
|
||||
static void shrink_shmem_memory(void)
|
||||
{
|
||||
struct sysinfo info;
|
||||
unsigned long nr_shmem_pages, nr_freed_pages;
|
||||
|
||||
si_meminfo(&info);
|
||||
nr_shmem_pages = info.sharedram; /* current page count used for shmem */
|
||||
/*
|
||||
* The intent is to reclaim all shmem pages. Though shrink_all_memory() can
|
||||
* only reclaim about half of them, it's enough for creating the hibernation
|
||||
* image.
|
||||
*/
|
||||
nr_freed_pages = shrink_all_memory(nr_shmem_pages);
|
||||
pr_debug("requested to reclaim %lu shmem pages, actually freed %lu pages\n",
|
||||
nr_shmem_pages, nr_freed_pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* hibernation_snapshot - Quiesce devices and create a hibernation image.
|
||||
* @platform_mode: If set, use platform driver to prepare for the transition.
|
||||
@@ -425,14 +408,9 @@ int hibernation_snapshot(int platform_mode)
|
||||
if (error)
|
||||
goto Close;
|
||||
|
||||
/* Preallocate image memory before shutting down devices. */
|
||||
error = hibernate_preallocate_memory();
|
||||
if (error)
|
||||
goto Close;
|
||||
|
||||
error = freeze_kernel_threads();
|
||||
if (error)
|
||||
goto Cleanup;
|
||||
goto Close;
|
||||
|
||||
if (hibernation_test(TEST_FREEZER)) {
|
||||
|
||||
@@ -445,19 +423,13 @@ int hibernation_snapshot(int platform_mode)
|
||||
}
|
||||
|
||||
error = dpm_prepare(PMSG_FREEZE);
|
||||
if (error) {
|
||||
dpm_complete(PMSG_RECOVER);
|
||||
goto Thaw;
|
||||
}
|
||||
if (error)
|
||||
goto Complete;
|
||||
|
||||
/*
|
||||
* Device drivers may move lots of data to shmem in dpm_prepare(). The shmem
|
||||
* pages will use lots of system memory, causing hibernation image creation
|
||||
* fail due to insufficient free memory.
|
||||
* This call is to force flush the shmem pages to swap disk and reclaim
|
||||
* the system memory so that image creation can succeed.
|
||||
*/
|
||||
shrink_shmem_memory();
|
||||
/* Preallocate image memory before shutting down devices. */
|
||||
error = hibernate_preallocate_memory();
|
||||
if (error)
|
||||
goto Complete;
|
||||
|
||||
console_suspend_all();
|
||||
pm_restrict_gfp_mask();
|
||||
@@ -492,10 +464,10 @@ int hibernation_snapshot(int platform_mode)
|
||||
platform_end(platform_mode);
|
||||
return error;
|
||||
|
||||
Complete:
|
||||
dpm_complete(PMSG_RECOVER);
|
||||
Thaw:
|
||||
thaw_kernel_threads();
|
||||
Cleanup:
|
||||
swsusp_free();
|
||||
goto Close;
|
||||
}
|
||||
|
||||
|
||||
+3
-10
@@ -570,29 +570,23 @@ struct crc_data {
|
||||
wait_queue_head_t done; /* crc update done */
|
||||
u32 *crc32; /* points to handle's crc32 */
|
||||
size_t **unc_len; /* uncompressed lengths */
|
||||
unsigned char **unc; /* uncompressed data */
|
||||
unsigned char *unc[]; /* uncompressed data */
|
||||
};
|
||||
|
||||
static struct crc_data *alloc_crc_data(int nr_threads)
|
||||
{
|
||||
struct crc_data *crc;
|
||||
|
||||
crc = kzalloc_obj(*crc);
|
||||
crc = kzalloc_flex(*crc, unc, nr_threads);
|
||||
if (!crc)
|
||||
return NULL;
|
||||
|
||||
crc->unc = kcalloc(nr_threads, sizeof(*crc->unc), GFP_KERNEL);
|
||||
if (!crc->unc)
|
||||
goto err_free_crc;
|
||||
|
||||
crc->unc_len = kzalloc_objs(*crc->unc_len, nr_threads);
|
||||
if (!crc->unc_len)
|
||||
goto err_free_unc;
|
||||
goto err_free_crc;
|
||||
|
||||
return crc;
|
||||
|
||||
err_free_unc:
|
||||
kfree(crc->unc);
|
||||
err_free_crc:
|
||||
kfree(crc);
|
||||
return NULL;
|
||||
@@ -607,7 +601,6 @@ static void free_crc_data(struct crc_data *crc)
|
||||
kthread_stop(crc->thr);
|
||||
|
||||
kfree(crc->unc_len);
|
||||
kfree(crc->unc);
|
||||
kfree(crc);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user