The patch titled Support for freezeable workqueues has been added to the -mm tree. Its filename is support-for-freezeable-workqueues.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: Support for freezeable workqueues From: "Rafael J. Wysocki" <rjw@xxxxxxx> Make it possible to create a workqueue the worker thread of which will be frozen during suspend, along with other kernel threads. Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx> Acked-by: Pavel Machek <pavel@xxxxxx> Cc: Nigel Cunningham <nigel@xxxxxxxxxxxx> Cc: David Chinner <dgc@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- include/linux/workqueue.h | 8 +++++--- kernel/workqueue.c | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff -puN include/linux/workqueue.h~support-for-freezeable-workqueues include/linux/workqueue.h --- a/include/linux/workqueue.h~support-for-freezeable-workqueues +++ a/include/linux/workqueue.h @@ -55,9 +55,11 @@ struct execute_work { } while (0) extern struct workqueue_struct *__create_workqueue(const char *name, - int singlethread); -#define create_workqueue(name) __create_workqueue((name), 0) -#define create_singlethread_workqueue(name) __create_workqueue((name), 1) + int singlethread, + int freezeable); +#define create_workqueue(name) __create_workqueue((name), 0, 0) +#define create_freezeable_workqueue(name) __create_workqueue((name), 0, 1) +#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0) extern void destroy_workqueue(struct workqueue_struct *wq); diff -puN kernel/workqueue.c~support-for-freezeable-workqueues kernel/workqueue.c --- a/kernel/workqueue.c~support-for-freezeable-workqueues +++ a/kernel/workqueue.c @@ -29,6 +29,7 @@ #include <linux/kthread.h> #include <linux/hardirq.h> #include <linux/mempolicy.h> +#include <linux/freezer.h> /* * The per-CPU workqueue (if single thread, we always use the first @@ -55,6 +56,8 @@ struct cpu_workqueue_struct { struct task_struct *thread; int run_depth; /* Detect run_workqueue() recursion depth */ + + int freezeable; /* Freeze the thread during suspend */ } ____cacheline_aligned; /* @@ -237,7 +240,8 @@ static int worker_thread(void *__cwq) struct k_sigaction sa; sigset_t blocked; - current->flags |= PF_NOFREEZE; + if (!cwq->freezeable) + current->flags |= PF_NOFREEZE; set_user_nice(current, -5); @@ -260,6 +264,9 @@ static int worker_thread(void *__cwq) set_current_state(TASK_INTERRUPTIBLE); while (!kthread_should_stop()) { + if (cwq->freezeable) + try_to_freeze(); + add_wait_queue(&cwq->more_work, &wait); if (list_empty(&cwq->worklist)) schedule(); @@ -336,7 +343,7 @@ void fastcall flush_workqueue(struct wor EXPORT_SYMBOL_GPL(flush_workqueue); static struct task_struct *create_workqueue_thread(struct workqueue_struct *wq, - int cpu) + int cpu, int freezeable) { struct cpu_workqueue_struct *cwq = per_cpu_ptr(wq->cpu_wq, cpu); struct task_struct *p; @@ -346,6 +353,7 @@ static struct task_struct *create_workqu cwq->thread = NULL; cwq->insert_sequence = 0; cwq->remove_sequence = 0; + cwq->freezeable = freezeable; INIT_LIST_HEAD(&cwq->worklist); init_waitqueue_head(&cwq->more_work); init_waitqueue_head(&cwq->work_done); @@ -361,7 +369,7 @@ static struct task_struct *create_workqu } struct workqueue_struct *__create_workqueue(const char *name, - int singlethread) + int singlethread, int freezeable) { int cpu, destroy = 0; struct workqueue_struct *wq; @@ -381,7 +389,7 @@ struct workqueue_struct *__create_workqu mutex_lock(&workqueue_mutex); if (singlethread) { INIT_LIST_HEAD(&wq->list); - p = create_workqueue_thread(wq, singlethread_cpu); + p = create_workqueue_thread(wq, singlethread_cpu, freezeable); if (!p) destroy = 1; else @@ -389,7 +397,7 @@ struct workqueue_struct *__create_workqu } else { list_add(&wq->list, &workqueues); for_each_online_cpu(cpu) { - p = create_workqueue_thread(wq, cpu); + p = create_workqueue_thread(wq, cpu, freezeable); if (p) { kthread_bind(p, cpu); wake_up_process(p); @@ -642,7 +650,7 @@ static int __devinit workqueue_cpu_callb mutex_lock(&workqueue_mutex); /* Create a new workqueue thread for it. */ list_for_each_entry(wq, &workqueues, list) { - if (!create_workqueue_thread(wq, hotcpu)) { + if (!create_workqueue_thread(wq, hotcpu, 0)) { printk("workqueue for %i failed\n", hotcpu); return NOTIFY_BAD; } _ Patches currently in -mm which might be from rjw@xxxxxxx are git-acpi.patch uswsusp-add-pmops-prepareenterfinish-support-aka-platform-mode.patch swsusp-use-partition-device-and-offset-to-identify-swap-areas.patch swsusp-rearrange-swap-handling-code.patch swsusp-use-block-device-offsets-to-identify-swap-locations-rev-2.patch swsusp-add-resume_offset-command-line-parameter-rev-2.patch swsusp-document-support-for-swap-files-rev-2.patch swsusp-add-ioctl-for-swap-files-support.patch swsusp-update-userland-interface-documentation.patch swsusp-improve-handling-of-highmem.patch swsusp-improve-handling-of-highmem-fix.patch swsusp-use-__gfp_wait.patch swsusp-fix-platform-mode.patch add-include-linux-freezerh-and-move-definitions-from.patch add-include-linux-freezerh-and-move-definitions-from-ueagle-fix.patch quieten-freezer-if-config_pm_debug.patch swsusp-cleanup-whitespace-in-freezer-output.patch swsusp-thaw-userspace-and-kernel-space-separately.patch swsusp-support-i386-systems-with-pae-or-without-pse.patch swsusp-freeze-filesystems-during-suspend-rev-2.patch swsusp-freeze-filesystems-during-suspend-rev-2-comments.patch suspend-dont-change-cpus_allowed-for-task-initiating-the-suspend.patch swsusp-measure-memory-shrinking-time.patch suspend-to-disk-fails-if-gdb-is-suspended-with-a-traced-child.patch support-for-freezeable-workqueues.patch use-freezeable-workqueues-in-xfs.patch md-change-lifetime-rules-for-md-devices.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html