Re: [PATCH] evdev: discard oldest event on buffer overflow

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

 



On Wed, Oct 27, 2010 at 4:57 PM, Dmitry Torokhov
<dmitry.torokhov@xxxxxxxxx> wrote:
> On Wed, Oct 27, 2010 at 12:09:58PM -0500, Bill Gatliff wrote:
>> This patch moves the tail pointer up one event on a buffer
>> overflow, which "consumes" the oldest event in the buffer
>> to make room for the incoming event.  Thus, although data
>> is lost due to the overflow (which is unavoidable), the
>> data that remains is both recent and still time-ordered.
>>
>
> It does not really matter... You are losing part of the hardware state
> regardless so the packet is invalid anyway. What would probably make
> more sense is to ignore all events up until next packet boundary
> (EV_SYN/SYN_REPORT) so userspace would get most up-to-date _full_ packet
> (when it catches up).

That's an interesting idea, actually.  Maybe the subject of a future patch.  :)

I still think my patch is a genuine improvement as-is, however.  But
perhaps not the final word on the issue.

For example, how do you recall the events that userspace has already
digested from the current packet?  One alternative is to not queue a
packet until the whole packet is ready, but that will introduce
latency.  I don't like that approach, either.  Hmmm...

I suppose another possibility is to always reserve enough room for an
EV_SYN/SYN_REPORT event, and never discard those events.  Then
userspace will always see a properly-terminated packet, but in a
collision it would receive a partial-but-properly-terminated packet.


b.g.
-- 
Bill Gatliff
bgat@xxxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux