summaryrefslogtreecommitdiff
path: root/drivers/platform/surface/aggregator/core.c
diff options
context:
space:
mode:
authorMaximilian Luz <luzmaximilian@gmail.com>2020-12-21 21:39:53 +0300
committerHans de Goede <hdegoede@redhat.com>2021-01-07 01:45:34 +0300
commit3a7081f610a0ff6385f38cf65a019383cd34bfdd (patch)
treeb5e52adf3bc7fd6574d04ea68c49505b99eb743f /drivers/platform/surface/aggregator/core.c
parent44b84ee7b437dd7f869341b4b671963161a34a9f (diff)
downloadlinux-3a7081f610a0ff6385f38cf65a019383cd34bfdd.tar.xz
platform/surface: aggregator: Add event item allocation caching
Event items are used for completing Surface Aggregator EC events, i.e. placing event command data and payload on a workqueue for later processing to avoid doing said processing directly on the receiver thread. This means that event items are allocated for each incoming event, regardless of that event being transmitted via sequenced or unsequenced packets. On the Surface Book 3 and Surface Laptop 3, touchpad HID input events (unsequenced), can constitute a larger amount of traffic, and therefore allocation of event items. This warrants caching event items to reduce memory fragmentation. The size of the cached objects is specifically tuned to accommodate keyboard and touchpad input events and their payloads on those devices. As a result, this effectively also covers most other event types. In case of a larger event payload, event item allocation will fall back to kzalloc(). Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201221183959.1186143-4-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/surface/aggregator/core.c')
-rw-r--r--drivers/platform/surface/aggregator/core.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/platform/surface/aggregator/core.c b/drivers/platform/surface/aggregator/core.c
index 60d312f71436..37593234fb31 100644
--- a/drivers/platform/surface/aggregator/core.c
+++ b/drivers/platform/surface/aggregator/core.c
@@ -790,12 +790,23 @@ static int __init ssam_core_init(void)
status = ssh_ctrl_packet_cache_init();
if (status)
- return status;
+ goto err_cpkg;
+
+ status = ssam_event_item_cache_init();
+ if (status)
+ goto err_evitem;
status = serdev_device_driver_register(&ssam_serial_hub);
if (status)
- ssh_ctrl_packet_cache_destroy();
+ goto err_register;
+ return 0;
+
+err_register:
+ ssam_event_item_cache_destroy();
+err_evitem:
+ ssh_ctrl_packet_cache_destroy();
+err_cpkg:
return status;
}
module_init(ssam_core_init);
@@ -803,6 +814,7 @@ module_init(ssam_core_init);
static void __exit ssam_core_exit(void)
{
serdev_device_driver_unregister(&ssam_serial_hub);
+ ssam_event_item_cache_destroy();
ssh_ctrl_packet_cache_destroy();
}
module_exit(ssam_core_exit);