con_open() is called on every open of the tty, even if the tty is already all set up. We only need to do that initialisation if the tty is being set up for the very first time (tty->count == 1). So do that: check for tty_count == 1 inside console_sem() and if so, bypass all the unnecessary initialisation. --- 25-akpm/drivers/char/vt.c | 40 +++++++++++++++++++--------------------- 1 files changed, 19 insertions(+), 21 deletions(-) diff -puN drivers/char/vt.c~con_open-speedup drivers/char/vt.c --- 25/drivers/char/vt.c~con_open-speedup 2004-03-25 10:08:38.428019360 -0800 +++ 25-akpm/drivers/char/vt.c 2004-03-25 10:20:59.352381736 -0800 @@ -2454,32 +2454,30 @@ static void con_flush_chars(struct tty_s /* * Allocate the console screen memory. */ -static int con_open(struct tty_struct *tty, struct file * filp) +static int con_open(struct tty_struct *tty, struct file *filp) { - unsigned int currcons; - int i; - - currcons = tty->index; + unsigned int currcons = tty->index; + int ret = 0; acquire_console_sem(); - i = vc_allocate(currcons); - if (i) { - release_console_sem(); - return i; + if (tty->count == 1) { + ret = vc_allocate(currcons); + if (ret == 0) { + vt_cons[currcons]->vc_num = currcons; + tty->driver_data = vt_cons[currcons]; + vc_cons[currcons].d->vc_tty = tty; + + if (!tty->winsize.ws_row && !tty->winsize.ws_col) { + tty->winsize.ws_row = video_num_lines; + tty->winsize.ws_col = video_num_columns; + } + release_console_sem(); + vcs_make_devfs(tty); + return ret; + } } - vt_cons[currcons]->vc_num = currcons; - tty->driver_data = vt_cons[currcons]; - vc_cons[currcons].d->vc_tty = tty; - release_console_sem(); - - if (!tty->winsize.ws_row && !tty->winsize.ws_col) { - tty->winsize.ws_row = video_num_lines; - tty->winsize.ws_col = video_num_columns; - } - if (tty->count == 1) - vcs_make_devfs(tty); - return 0; + return ret; } static void con_close(struct tty_struct *tty, struct file *filp) _