* work_struct not getting scheduled
@ 2011-04-21 12:14 Pankaj B
2011-04-21 15:32 ` Michael Blizek
2011-04-21 15:59 ` Dave Hylands
0 siblings, 2 replies; 5+ messages in thread
From: Pankaj B @ 2011-04-21 12:14 UTC (permalink / raw)
To: kernelnewbies
Hi,
At my end I was using tasklets to do some handling. But while
doing the handling the handler had to sleep, so I had to switch to
workqueues. I am scheduling a work as follows:
INIT_WORK(&event->work, do_handling_work);
schedule_work(&event->work);
flush_scheduled_work();
But the work never gets scheduled. I have put some printks in the
do_handling_work() function. Creating workqueue and queueing
the work to that workqueue doen't work either. I find this a
very strange problem. Does anybody knows about this?
FYI: my system has heavy IO load when I schedule the work.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110421/389ae5bb/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* work_struct not getting scheduled
2011-04-21 12:14 work_struct not getting scheduled Pankaj B
@ 2011-04-21 15:32 ` Michael Blizek
2011-04-23 3:46 ` Pankaj B
2011-04-21 15:59 ` Dave Hylands
1 sibling, 1 reply; 5+ messages in thread
From: Michael Blizek @ 2011-04-21 15:32 UTC (permalink / raw)
To: kernelnewbies
Hi!
On 17:44 Thu 21 Apr , Pankaj B wrote:
...
> INIT_WORK(&event->work, do_handling_work);
> schedule_work(&event->work);
> flush_scheduled_work();
>
> But the work never gets scheduled. I have put some printks in the
> do_handling_work() function. Creating workqueue and queueing
> the work to that workqueue doen't work either. I find this a
> very strange problem. Does anybody knows about this?
>
> FYI: my system has heavy IO load when I schedule the work.
1) Why call flush_scheduled_work? This function will wait until
do_handling_work is finished. You could just call do_handling_work directly...
2) If you have heavy IO load, it might will up the workqueues. It should not
cause total starvation. But if (1) did not solve your problem, try reproducing
it while the system is idle.
-Michi
--
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* work_struct not getting scheduled
2011-04-21 12:14 work_struct not getting scheduled Pankaj B
2011-04-21 15:32 ` Michael Blizek
@ 2011-04-21 15:59 ` Dave Hylands
2011-04-21 16:42 ` Himanshu Chauhan
1 sibling, 1 reply; 5+ messages in thread
From: Dave Hylands @ 2011-04-21 15:59 UTC (permalink / raw)
To: kernelnewbies
Hi Pankaj,
On Thu, Apr 21, 2011 at 5:14 AM, Pankaj B <xpankajbx@gmail.com> wrote:
> Hi,
> At my end I was using tasklets to do some handling. But while
> doing the handling the handler had to sleep, so I had to switch to
> ?workqueues. I am scheduling a work as follows:
> INIT_WORK(&event->work, do_handling_work);
> schedule_work(&event->work);
> flush_scheduled_work();
> But the work never gets scheduled. I have put some printks in the
> do_handling_work() function. Creating workqueue and queueing
> the work to that workqueue doen't work either. I find this a
> very strange problem. Does anybody knows about this?
> FYI: my system has heavy IO load when I schedule the work.
Which version of linux are you using?
--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* work_struct not getting scheduled
2011-04-21 15:59 ` Dave Hylands
@ 2011-04-21 16:42 ` Himanshu Chauhan
0 siblings, 0 replies; 5+ messages in thread
From: Himanshu Chauhan @ 2011-04-21 16:42 UTC (permalink / raw)
To: kernelnewbies
On Thu, Apr 21, 2011 at 9:29 PM, Dave Hylands <dhylands@gmail.com> wrote:
> Hi Pankaj,
>
> On Thu, Apr 21, 2011 at 5:14 AM, Pankaj B <xpankajbx@gmail.com> wrote:
>> Hi,
>> At my end I was using tasklets to do some handling. But while
>> doing the handling the handler had to sleep, so I had to switch to
>> ?workqueues. I am scheduling a work as follows:
>> INIT_WORK(&event->work, do_handling_work);
>> schedule_work(&event->work);
>> flush_scheduled_work();
>> But the work never gets scheduled. I have put some printks in the
>> do_handling_work() function. Creating workqueue and queueing
>> the work to that workqueue doen't work either. I find this a
>> very strange problem. Does anybody knows about this?
>> FYI: my system has heavy IO load when I schedule the work.
<snip from lwn>
It turned out these functions were used in ~800 places, and in ~90% of
them the return value was ignored! This is perhaps understandble, because
the only way these functions can fail is if their work_struct argument is
uninitialized or already in use. (Whether it's robust for callers to
depend on this behavior remaining unchanged into the indefinite future is
more questionable.)
</snip from lwn>
For more read:
http://lwn.net/Articles/197318/
This might help you.
Regards
Himanshu
^ permalink raw reply [flat|nested] 5+ messages in thread
* work_struct not getting scheduled
2011-04-21 15:32 ` Michael Blizek
@ 2011-04-23 3:46 ` Pankaj B
0 siblings, 0 replies; 5+ messages in thread
From: Pankaj B @ 2011-04-23 3:46 UTC (permalink / raw)
To: kernelnewbies
On Thu, Apr 21, 2011 at 9:02 PM, Michael Blizek <
michi1@michaelblizek.twilightparadox.com> wrote:
> Hi!
>
> On 17:44 Thu 21 Apr , Pankaj B wrote:
> ...
> > INIT_WORK(&event->work, do_handling_work);
> > schedule_work(&event->work);
> > flush_scheduled_work();
> >
> > But the work never gets scheduled. I have put some printks in the
> > do_handling_work() function. Creating workqueue and queueing
> > the work to that workqueue doen't work either. I find this a
> > very strange problem. Does anybody knows about this?
> >
> > FYI: my system has heavy IO load when I schedule the work.
>
> 1) Why call flush_scheduled_work? This function will wait until
> do_handling_work is finished. You could just call do_handling_work
> directly...
do_handling_work is to be called/scheduled from the interrupt context.
Actually I was not calling flush_scheduled_work() initially(it sleeps), I
tried it because
work was not getting scheduled. I can not call do_handling_work() directly
because it sleeps.
>
> 2) If you have heavy IO load, it might will up the workqueues. It should
> not
> cause total starvation. But if (1) did not solve your problem, try
> reproducing
> it while the system is idle.
>
Work get scheduled when the system is idle.
Somehow the work is getting scheduled now. I doubt another thread which was
causing
system to become non-responsive for most of the time.
@Dave: I am using linux kernel 2.6.30.2
@Himanshu: Good point. I checked return value of schedule_work(),
I am getting non-zero value which is expected.
Thank you all.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110423/02e813d0/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-04-23 3:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-21 12:14 work_struct not getting scheduled Pankaj B
2011-04-21 15:32 ` Michael Blizek
2011-04-23 3:46 ` Pankaj B
2011-04-21 15:59 ` Dave Hylands
2011-04-21 16:42 ` Himanshu Chauhan
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).