summaryrefslogtreecommitdiff
path: root/drivers/platform/surface/aggregator/controller.h
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/controller.h
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/controller.h')
-rw-r--r--drivers/platform/surface/aggregator/controller.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/platform/surface/aggregator/controller.h b/drivers/platform/surface/aggregator/controller.h
index 5ee9e966f1d7..8297d34e7489 100644
--- a/drivers/platform/surface/aggregator/controller.h
+++ b/drivers/platform/surface/aggregator/controller.h
@@ -80,12 +80,18 @@ struct ssam_cplt;
* struct ssam_event_item - Struct for event queuing and completion.
* @node: The node in the queue.
* @rqid: The request ID of the event.
+ * @ops: Instance specific functions.
+ * @ops.free: Callback for freeing this event item.
* @event: Actual event data.
*/
struct ssam_event_item {
struct list_head node;
u16 rqid;
+ struct {
+ void (*free)(struct ssam_event_item *event);
+ } ops;
+
struct ssam_event event; /* must be last */
};
@@ -273,4 +279,7 @@ int ssam_ctrl_notif_d0_entry(struct ssam_controller *ctrl);
int ssam_controller_suspend(struct ssam_controller *ctrl);
int ssam_controller_resume(struct ssam_controller *ctrl);
+int ssam_event_item_cache_init(void);
+void ssam_event_item_cache_destroy(void);
+
#endif /* _SURFACE_AGGREGATOR_CONTROLLER_H */