diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /Documentation/power/kernel_threads.txt |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'Documentation/power/kernel_threads.txt')
-rw-r--r-- | Documentation/power/kernel_threads.txt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Documentation/power/kernel_threads.txt b/Documentation/power/kernel_threads.txt new file mode 100644 index 000000000000..60b548105edf --- /dev/null +++ b/Documentation/power/kernel_threads.txt | |||
@@ -0,0 +1,41 @@ | |||
1 | KERNEL THREADS | ||
2 | |||
3 | |||
4 | Freezer | ||
5 | |||
6 | Upon entering a suspended state the system will freeze all | ||
7 | tasks. This is done by delivering pseudosignals. This affects | ||
8 | kernel threads, too. To successfully freeze a kernel thread | ||
9 | the thread has to check for the pseudosignal and enter the | ||
10 | refrigerator. Code to do this looks like this: | ||
11 | |||
12 | do { | ||
13 | hub_events(); | ||
14 | wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); | ||
15 | if (current->flags & PF_FREEZE) | ||
16 | refrigerator(PF_FREEZE); | ||
17 | } while (!signal_pending(current)); | ||
18 | |||
19 | from drivers/usb/core/hub.c::hub_thread() | ||
20 | |||
21 | |||
22 | The Unfreezable | ||
23 | |||
24 | Some kernel threads however, must not be frozen. The kernel must | ||
25 | be able to finish pending IO operations and later on be able to | ||
26 | write the memory image to disk. Kernel threads needed to do IO | ||
27 | must stay awake. Such threads must mark themselves unfreezable | ||
28 | like this: | ||
29 | |||
30 | /* | ||
31 | * This thread doesn't need any user-level access, | ||
32 | * so get rid of all our resources. | ||
33 | */ | ||
34 | daemonize("usb-storage"); | ||
35 | |||
36 | current->flags |= PF_NOFREEZE; | ||
37 | |||
38 | from drivers/usb/storage/usb.c::usb_stor_control_thread() | ||
39 | |||
40 | Such drivers are themselves responsible for staying quiet during | ||
41 | the actual snapshotting. | ||