Re: Sleep and Wake up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Abu...

On Tue, May 3, 2011 at 01:32, Abu Rasheda <rcpilot2010@xxxxxxxxx> wrote:
> I am testing my driver on much faster host processor and facing
> following issues:
>
> My host is too powerful and it can fill up device buffer queue very fast.
>
> I get best performance when I do busy wait, but this is not desirable
> and is bad design.

For me, busy waiting could be the best for your case... in fact, NAPI
sometimes do that too....in most cases.

Actually, devices usually fills the in-RAM buffer with the help of
interrupt(s). So whenever in-device buffer has something new, it
interrupts...then soft irq follows up by copying them to RAM buffe
(circular buffer usually). To make it fast, DMA  or other CPU less
operation kicks in here.

So I think that;s the key...by relying on the interrupts...then you
will know when your buffer is about to be full.

Other than that, I would still say, busy waiting could be your best bet.

PS: here's crazy idea, if you can accept it. Put a guard page, right
at the tail of your buffer,. Make it unwritable even by kernel mode.
Right when you hit it, page fault should kicks in. Then you know
buffer is full. This is inspired by the stack guard..usual method in
user space to reduce buffer overflow risk.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux