suspend/resume timings

Jens Axboe olpc-devel at
Sun Apr 1 15:09:19 EDT 2007


I took a look at the time spent doing a suspend and resume cycle. In
general things go pretty fast, most devices handle it really quickly.
USB is a bit slow (~100 msec), but I ignored that since apparently there
are already people working on fixing USB suspend (functionality, speed
of course comes second).

The slowest parts are the keyboard and mouse. psmouse takes ~570 msec to
resume alone, and the keyboard is no speed daemon at ~269 msecs. Looking
at the psmouse first, by far the majority of the time is spend resetting
the device (drivers/input/mouse/olpc.c:olpc_reconnect() ->
psmouse_reset()). A quick test works fine for me without the reset, but
that may not be a sound approach. Perhaps deferring a reset to IFF
olpc_get_model() fails would be more safe?

I'll be playing some more with the timings and testing over the next
week, do let me know if there's something more urgent in suspend/resume
area that needs attention.

The kernel used was current olpc-2.6.

diff --git a/drivers/input/mouse/olpc.c b/drivers/input/mouse/olpc.c
index 5f813f5..d2df132 100644
--- a/drivers/input/mouse/olpc.c
+++ b/drivers/input/mouse/olpc.c
@@ -351,12 +351,19 @@ static int olpc_poll(struct psmouse *psmouse)
 static int olpc_reconnect(struct psmouse *psmouse)
 	struct olpc_data *priv = psmouse->private;
+	struct olpc_model_info *info;
 	int mode;
-	psmouse_reset(psmouse);
-	if (!(priv->i = olpc_get_model(psmouse)))
-		return -1;
+	/*
+	 * defer reset to if olpc_get_model() fails, it's quite a time eater
+	 */
+	priv->i = olpc_get_model(psmouse);
+	if (!priv->i) {
+		psmouse_reset(psmouse);
+		priv->i = olpc_get_model(psmouse);
+		if (!priv->i)
+			return -1;
+	}
 	mode = olpc_find_mode(psmouse);
 	if (mode < 0)

Jens Axboe

More information about the Devel mailing list