Revision be1fd94fd698e9dfa2676f688d4e9b034e0d4b9e authored by Linus Torvalds on 12 May 2006, 19:14:52 UTC, committed by Linus Torvalds on 12 May 2006, 19:14:52 UTC
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6:
  [PATCH] scx200_acb: Fix for the CS5535 errata
  [PATCH] scx200_acb: Fix resource name use after free
  [PATCH] scx200_acb: Fix return on init error
2 parent s 0d38edd + 95563d3
Raw File
kernel_threads.txt
KERNEL THREADS


Freezer

Upon entering a suspended state the system will freeze all
tasks. This is done by delivering pseudosignals. This affects
kernel threads, too. To successfully freeze a kernel thread
the thread has to check for the pseudosignal and enter the
refrigerator. Code to do this looks like this:

	do {
		hub_events();
		wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list));
		try_to_freeze();
	} while (!signal_pending(current));

from drivers/usb/core/hub.c::hub_thread()


The Unfreezable

Some kernel threads however, must not be frozen. The kernel must
be able to finish pending IO operations and later on be able to
write the memory image to disk. Kernel threads needed to do IO
must stay awake. Such threads must mark themselves unfreezable
like this:

	/*
	 * This thread doesn't need any user-level access,
	 * so get rid of all our resources.
	 */
	daemonize("usb-storage");

	current->flags |= PF_NOFREEZE;

from drivers/usb/storage/usb.c::usb_stor_control_thread()

Such drivers are themselves responsible for staying quiet during
the actual snapshotting.
back to top