[PATCH] vt: refactor console SAK processing

This does several things.
- It moves looking up of the current foreground console into process
  context where we can safely take the semaphore that protects this
  operation.
- It uses the new flavor of work queue processing.
- This generates a factor of do_SAK, __do_SAK that runs immediately.
- This calls __do_SAK with the console semaphore held ensuring nothing
  else happens to the console while we process the SAK operation.
- With the console SAK processing moved into process context this
  patch removes the xchg operations that I used to attempt to attomically
  update struct pid, because of the strange locking used in the SAK processing.
  With SAK using the normal console semaphore nothing special is needed.

Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Eric W. Biederman
2007-02-10 01:44:34 -08:00
committed by Linus Torvalds
parent 0a7b35cb18
commit 8b6312f4dc
6 changed files with 45 additions and 18 deletions

View File

@@ -595,15 +595,9 @@ static void fn_spawn_con(struct vc_data *vc)
static void fn_SAK(struct vc_data *vc)
{
struct tty_struct *tty = vc->vc_tty;
/*
* SAK should also work in all raw modes and reset
* them properly.
*/
if (tty)
do_SAK(tty);
reset_vc(vc);
struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work;
PREPARE_WORK(SAK_work, vc_SAK);
schedule_work(SAK_work);
}
static void fn_null(struct vc_data *vc)