Messages in this thread Patch in this message | | | From | Nigel Cunningham <> | Subject | [ 22/23] [Suspend2] Modify swsusp to thaw kernel threads while eating memory. | Date | Thu, 26 Jan 2006 13:46:11 +1000 |
| |
Modify swsusp so that while trying to eat memory, it allows kernel threads to run. This avoids a deadlock that could otherwise occur if access to a filesystem is needed while freeing the memory.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
kernel/power/main.c | 4 ++++ kernel/power/swsusp.c | 3 +++ 2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/kernel/power/main.c b/kernel/power/main.c index 6f854e4..2fed3dc 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -72,6 +72,8 @@ static int suspend_prepare(suspend_state goto Thaw; } + thaw_processes(FREEZER_KERNEL_THREADS); + if ((free_pages = nr_free_pages()) < FREE_PAGE_NUMBER) { pr_debug("PM: free some memory\n"); shrink_all_memory(FREE_PAGE_NUMBER - free_pages); @@ -82,6 +84,8 @@ static int suspend_prepare(suspend_state } } + freeze_processes(); + if (pm_ops->prepare) { if ((error = pm_ops->prepare(state))) goto Thaw; diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index 55a18d2..3bc835a 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c @@ -575,6 +575,8 @@ int swsusp_shrink_memory(void) unsigned int i = 0; char *p = "-\\|/"; + thaw_processes(FREEZER_KERNEL_THREADS); + printk("Shrinking memory... "); do { size = 2 * count_highmem_pages(); @@ -598,6 +600,7 @@ int swsusp_shrink_memory(void) } while (tmp > 0); printk("\bdone (%lu pages freed)\n", pages); + freeze_processes(); return 0; } -- Nigel Cunningham nigel at suspend2 dot net - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |