From bfaaaf892e3c070af9bf6fa4bfe33369fbfcbef2 Mon Sep 17 00:00:00 2001 From: Wentao Guan Date: Fri, 17 Apr 2026 15:22:48 +0800 Subject: [PATCH] Input: evdev - Modify the process of closing the evdev device to use the synchronize_rcu_expedited interface to speed up the shutdown process. deepin inclusion categroy: performace As Documentations saied: synchronize_rcu_expedited() instead of synchronize_rcu(). This reduces latency, but can increase CPU utilization, degrade real-time latency, and degrade energy efficiency. use it to optimize the shutdown process by our system developer report where some input dev shutdown cost many XXms. With the patched kernel, shutdown cost time from 5.96 to 5.11. Tested-by: qiancheng Signed-off-by: huangbibo Signed-off-by: tuhaowen Signed-off-by: Wentao Guan --- drivers/input/evdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 95f90699d2b17..c2d41a7c3b090 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -383,7 +383,13 @@ static void evdev_detach_client(struct evdev *evdev, spin_lock(&evdev->client_lock); list_del_rcu(&client->node); spin_unlock(&evdev->client_lock); - synchronize_rcu(); + + if (system_state == SYSTEM_HALT || + system_state == SYSTEM_POWER_OFF || + system_state == SYSTEM_RESTART) + synchronize_rcu_expedited(); + else + synchronize_rcu(); } static int evdev_open_device(struct evdev *evdev)