---
 kernel/workqueue.c |   32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1065,3 +1065,35 @@ void __init init_workqueues(void)
 	BUG_ON(!work_on_cpu_wq);
 #endif
 }
+
+#define DEBUG
+#ifdef DEBUG
+static long test_fn(void *arg)
+{
+	printk("%u: %lu\n", smp_processor_id(), (long)arg);
+	return (long)arg + 100;
+}
+
+static int __init test_work_on_cpu(void)
+{
+	unsigned int i;
+
+	for_each_online_cpu(i) {
+		long ret = work_on_cpu(i, test_fn, (void *)i);
+		printk("CPU %i returned %li\n", i, ret);
+		BUG_ON(ret != i + 100);
+	}
+
+	for_each_online_cpu(i) {
+		struct workqueue_struct *wq
+			= create_singlethread_workqueue("myq");
+		long ret = __work_on_cpu(wq, i, test_fn, (void *)i);
+		destroy_workqueue(wq);
+		printk("CPU %i returned %li\n", i, ret);
+		BUG_ON(ret != i + 100);
+	}
+
+	return 0;
+}
+module_init(test_work_on_cpu);
+#endif /* DEBUG */
