<div dir="ltr">Hi Rajat,<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 15, 2013 at 7:16 AM, Rajat Jain <span dir="ltr">&lt;<a href="mailto:rajatjain@juniper.net" target="_blank">rajatjain@juniper.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I have a single work queue, on which I have scheduled a worker function [using queue_work(wq, fn)] in interrupt context.<br>
<br>
I get the interrupt twice before the work queue gets a chance to run, and hence the same function will get queued twice (with different private context - arguments etc) which is fine and expected.<br>
<br>
Questions:<br>
<br>
1) Is it possible that the instance that was queued by 2nd interrupt, can get to run BEFORE the instance that was queued by 1st interrupt? In other words, is reordering possible?<br></blockquote><div><br></div><div>It is unlikely as workqueue would have internal queing of tasks.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
2) Is it possible that one running instance of the function, can get preempted by second instance of the same work queue? I read through <a href="http://lwn.net/Articles/511421/" target="_blank">http://lwn.net/Articles/511421/</a> and it talks about same work queue cannot run on different CPU, but I have doubt about single CPU. If If I am writing a worker function, does my code have to be ready that it can be preempted by another instance of the same function?<br>

<br></blockquote><div><br></div><div>Do you mean the system has just one CPU, then there would be just one worker thread in the workqueue which will pick up requests one by one. Do you see multiple threads?<br></div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Please note that I understand that my worker function can preempted by other processes, my doubts are related to the same workqueue.<br>
<br>
Thanks,<br>
<br>
Rajat<br>
<br>
<br></blockquote><div><br></div><div>Rajat<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br></div></div>