<div><br></div><div>Hi Devendra,</div><div><br></div><div> In the kernel thread if you continuously in a loop read a register it will increase</div><div>the CPU usage. After every register read if data is not ready call a schedule() (or related</div>
<div>call). This may help to reduce CPU utilization</div><div><br></div><div>Regards</div><div><br></div><div>Kshemendra</div><div><br></div><div> </div><div><br><div class="gmail_quote">On Fri, Oct 5, 2012 at 11:45 AM, Kshemendra KP <span dir="ltr"><<a href="mailto:kshemendra@suphalaam.com" target="_blank">kshemendra@suphalaam.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div>softirqs and tasklets run in interrupt context and must not sleep. </div><div>One cannot use copy_from_user() and copy_to_user() in both of them. </div>
<div><br></div><div><br></div><div>Regards</div><span><font color="#888888"><div>
<br></div><div>Kshemendra</div></font></span><div><div><div><br></div><br><br><div class="gmail_quote">On Fri, Oct 5, 2012 at 10:24 AM, devendra.aaru <span dir="ltr"><<a href="mailto:devendra.aaru@gmail.com" target="_blank">devendra.aaru@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Thu, Oct 4, 2012 at 1:50 PM, Mulyadi Santosa<br>
<<a href="mailto:mulyadi.santosa@gmail.com" target="_blank">mulyadi.santosa@gmail.com</a>> wrote:<br>
> Hi...<br>
><br>
> On Thu, Oct 4, 2012 at 7:03 PM, devendra.aaru <<a href="mailto:devendra.aaru@gmail.com" target="_blank">devendra.aaru@gmail.com</a>> wrote:<br>
>> Hi all,<br>
>><br>
>> I found that you can use a kernel timer and poll for the hardware<br>
>> interrupt registers whether the interrupt flag is set or not,<br>
>><br>
>> but this will take atleast some good amount of CPU.<br>
><br>
> yeah, thing is, as you know, timer fires interrupt and CPU will<br>
> certainly have to service it. So, it's impossible to work around it<br>
> IMHO<br>
><br>
>> are there any ways other than using the kernel timer?<br>
><br>
> perhaps something less intrusive like creating kernel thread and its<br>
> function is solely checking register state?<br>
><br>
<br>
</div>yes, more or less similar to what the kernel timer does, :)<br>
<br>
I think actually when i get the data , i am just copying it to my<br>
local structures,<br>
<br>
This job is done in the kernel timer itself, with this itself its<br>
taking a 10% of cpu<br>
which is actually too much.<br>
<br>
let me try with softirqs, i am going to use tasklets, what do you think ? :)<br>
<div><div>> --<br>
> regards,<br>
><br>
> Mulyadi Santosa<br>
> Freelance Linux trainer and consultant<br>
><br>
> blog: <a href="http://the-hydra.blogspot.com" target="_blank">the-hydra.blogspot.com</a><br>
> training: <a href="http://mulyaditraining.blogspot.com" target="_blank">mulyaditraining.blogspot.com</a><br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">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>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div>