*参照元 [#nfc0abf5] #backlinks *説明 [#t12d42e7] -パス: [[linux-2.6.33/kernel/workqueue.c]] -FIXME: これは何? --説明 **引数 [#m47f4281] -struct cpu_workqueue_struct *cwq -- **返り値 [#y282ca3f] -なし **参考 [#r52b2644] *実装 [#g2f33d2c] static void run_workqueue(struct cpu_workqueue_struct *cwq) { spin_lock_irq(&cwq->lock); - --[[linux-2.6.33/spin_lock_irq()]] while (!list_empty(&cwq->worklist)) { - --[[linux-2.6.33/list_empty()]] struct work_struct *work = list_entry(cwq->worklist.next, struct work_struct, entry); work_func_t f = work->func; - --[[linux-2.6.33/work_struct]] - --[[linux-2.6.33/list_entry()]] - --[[linux-2.6.33/work_func_t]] #ifdef CONFIG_LOCKDEP - --[[linux-2.6.33/CONFIG_LOCKDEP]] /* * It is permissible to free the struct work_struct * from inside the function that is called from it, * this we need to take into account for lockdep too. * To avoid bogus "held lock freed" warnings as well * as problems when looking into work->lockdep_map, * make a copy and use that here. */ struct lockdep_map lockdep_map = work->lockdep_map; - --[[linux-2.6.33/lockdep_map]] #endif trace_workqueue_execution(cwq->thread, work); debug_work_deactivate(work); cwq->current_work = work; - --[[linux-2.6.33/trace_workqueue_execution()]] - --[[linux-2.6.33/debug_work_deactivate()]] list_del_init(cwq->worklist.next); spin_unlock_irq(&cwq->lock); - --[[linux-2.6.33/list_del_init()]] - --[[linux-2.6.33/spin_unlock_irq()]] BUG_ON(get_wq_data(work) != cwq); work_clear_pending(work); lock_map_acquire(&cwq->wq->lockdep_map); lock_map_acquire(&lockdep_map); - --[[linux-2.6.33/BUG_ON()]] - --[[linux-2.6.33/get_wq_data()]] - --[[linux-2.6.33/work_clear_pending()]] - --[[linux-2.6.33/lock_map_acquire()]] f(work); lock_map_release(&lockdep_map); lock_map_release(&cwq->wq->lockdep_map); - --[[linux-2.6.33/lock_map_release()]] if (unlikely(in_atomic() || lockdep_depth(current) > 0)) { - --[[linux-2.6.33/current(global)]] - --[[linux-2.6.33/unlikely()]] - --[[linux-2.6.33/in_atomic()]] - --[[linux-2.6.33/lockdep_depth()]] printk(KERN_ERR "BUG: workqueue leaked lock or atomic: " "%s/0x%08x/%d\n", current->comm, preempt_count(), task_pid_nr(current)); printk(KERN_ERR " last function: "); print_symbol("%s\n", (unsigned long)f); debug_show_held_locks(current); dump_stack(); - --[[linux-2.6.33/KERN_ERR]] - --[[linux-2.6.33/printk()]] - --[[linux-2.6.33/preempt_count()]] - --[[linux-2.6.33/task_pid_nr()]] - --[[linux-2.6.33/print_symbol()]] - --[[linux-2.6.33/debug_show_held_locks()]] - --[[linux-2.6.33/dump_stack()]] } spin_lock_irq(&cwq->lock); cwq->current_work = NULL; } spin_unlock_irq(&cwq->lock); } *コメント [#q7cc5ef9]