* Call flush_scheduled_work in the context of a work routine
@ 2020-04-30 12:24 Bogdan Bogush
0 siblings, 0 replies; only message in thread
From: Bogdan Bogush @ 2020-04-30 12:24 UTC (permalink / raw)
To: kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 784 bytes --]
The comment to flush_scheduled_work states that calling this function in
the context of a work routine will lead to deadlock. I think it means
following scenario:
static void
handler(struct work_struct *work)
{
flush_scheduled_work();
}
static DECLARE_WORK(work, handler);
schedule_work(&work);
If this is true for system workqueue (system_wq) is it also applied to
custom workqueue? I want to wait for completion of the workqueues in
another workqueue. For example:
static void
handler(struct work_struct *work)
{
struct work_data * data = (struct work_data *)work;
flush_scheduled_work();
kfree(data);
}
wq = create_workqueue("wq_test");
data = kmalloc(sizeof(struct work_data), GFP_KERNEL);
INIT_WORK(&data->work, handler);
queue_work(wq, &data->work);
[-- Attachment #1.2: Type: text/html, Size: 1150 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-30 12:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 12:24 Call flush_scheduled_work in the context of a work routine Bogdan Bogush
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).