What happens when kernel remapping delayed_work

I use a common kernel working environment, and I have a structure delayed_workthat I want to transfer to immediate execution.

Will the following code guarantee that it delayed_workwill be launched as soon as possible?

cancel_delayed_work(work);
schedule_delayed_work(work, 0);

What happens when a job is already running? cancel_delayed_workwill return 0, but I'm not sure what it will do schedule_delayed_workif work is currently running or unplanned.

+5
source share
1 answer

, , ( ). , ​​/workqueue.c. Documentation/workqueue.txt, Concurrency Managed Workqueue (cmwq), !

[ ] , delayed_work ?

( )

, ?

- delayed_work , , , ( , ), . , delayed_work work_struct work->func.

, -, struct delayed_work struct work_struct, a struct work_struct . -, concurrency. A work_struct "", data WORK_STRUCT_PENDING. , set_work_pool_and_clear_pending() - , API work_struct ( , ). cancel_delayed_work() .

, cancel_delayed_work(), , false ( ), -, . , schedule_delayed_work(), , pool_workqueue, - pool_workqueue . ( work->func), pool_workqueue , ! . ( work->func , work_struct.)

, , schedule_delayed_work() , - ​​ , .

EDIT: , Documentation/workqueue.txt WQ_NON_REENTRANT, . , .

+4

All Articles