Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

backtracetest: Convert from tasklet to BH workqueue

The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts backtracetest from tasklet to BH workqueue.

- Replace "irq" with "bh" in names and message to better reflect what's
happening.

- Replace completion usage with a flush_work() call.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>

+7 -11
+7 -11
kernel/backtracetest.c
··· 21 21 dump_stack(); 22 22 } 23 23 24 - static DECLARE_COMPLETION(backtrace_work); 25 - 26 - static void backtrace_test_irq_callback(unsigned long data) 24 + static void backtrace_test_bh_workfn(struct work_struct *work) 27 25 { 28 26 dump_stack(); 29 - complete(&backtrace_work); 30 27 } 31 28 32 - static DECLARE_TASKLET_OLD(backtrace_tasklet, &backtrace_test_irq_callback); 29 + static DECLARE_WORK(backtrace_bh_work, &backtrace_test_bh_workfn); 33 30 34 - static void backtrace_test_irq(void) 31 + static void backtrace_test_bh(void) 35 32 { 36 - pr_info("Testing a backtrace from irq context.\n"); 33 + pr_info("Testing a backtrace from BH context.\n"); 37 34 pr_info("The following trace is a kernel self test and not a bug!\n"); 38 35 39 - init_completion(&backtrace_work); 40 - tasklet_schedule(&backtrace_tasklet); 41 - wait_for_completion(&backtrace_work); 36 + queue_work(system_bh_wq, &backtrace_bh_work); 37 + flush_work(&backtrace_bh_work); 42 38 } 43 39 44 40 #ifdef CONFIG_STACKTRACE ··· 61 65 pr_info("====[ backtrace testing ]===========\n"); 62 66 63 67 backtrace_test_normal(); 64 - backtrace_test_irq(); 68 + backtrace_test_bh(); 65 69 backtrace_test_saved(); 66 70 67 71 pr_info("====[ end of backtrace testing ]====\n");