[PATCH libevdev 3/5] Reduce memory requirement for MT syncing

Benjamin Tissoires benjamin.tissoires at gmail.com
Mon Mar 3 07:47:50 PST 2014


On Thu, Feb 27, 2014 at 1:27 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> Changes the algorithm: before we'd ioctl all axes for all slots, then generate
> events for all slots one-by-one.
>
> Now we ioctl the slot state for each axis, copy the new event value into
> the device and mark a bitfield that we've updated the value. Then loop through
> the slots and generate events where changed.
>
> Side-effect: this makes it easy to check if anything in the slot has updated,
> so we can skip empty slot events during sync.
>
> Min memory requirement for the state storage was:
>   MAX_SLOTS  * (ABS_MT_CNT + 1) * sizeof(int) = 1980
> Min memory requirement now:
>   (ABS_MT_CNT + 1) * sizeof(int) + NLONGS((MAX_SLOTS * ABS_MT_CNT) bits) = 544
>
> This is sigsafe code, so this was stack memory. Reducing the requirement
> allows us to up MAX_SLOTS in the future if we need to.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---

Reviewed-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>

Cheers,
Benjamin


More information about the Input-tools mailing list