40 lines · 1.1 KB · Text
RawDownload
KERNEL THREADS  Freezer Upon entering a suspended state the system will freeze alltasks. This is done by delivering pseudosignals. This affectskernel threads, too. To successfully freeze a kernel threadthe thread has to check for the pseudosignal and enter therefrigerator. 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 mustbe able to finish pending IO operations and later on be able towrite the memory image to disk. Kernel threads needed to do IOmust stay awake. Such threads must mark themselves unfreezablelike 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 duringthe actual snapshotting.