On Sun, 2007-06-03 at 18:05 +0300, Timo Sirainen wrote:
My laptop runs a local IMAP server so that I'm immune from breaking my mail client, and when playing around with powertop I discovered that Dovecot (in particular imap-login) wakes up every 1000ms and then every 50ms even when no clients are connected. A bit of stracing shows this:
I did once try to reduce these unnecessary wakeups, but then I thought it's probably not worth the trouble. No-one's going to run an IMAP server in their laptop.. :)
This fixes it for imap/pop3-login: http://hg.dovecot.org/dovecot/rev/0021765627f3
Fixing dovecot-auth and dovecot processes is a bit more difficult. Patches welcome. :)
Maybe the optimal solution would be to create a new abstraction layer. Most of the timeout handlers are just checking for idle timeouts.
struct idle_timeout *idle_timeout_new(unsigned int secs, timeout_callback_t *callback, void *context); void idle_timeout_free(struct idle_timeout *idle); void idle_timeout_reset(struct idle_timeout *idle);
The code would internally keep just one timeout handler and whenever it's called, calculate the new time when it should be called.