Freezer: make kernel threads nonfreezable by default
authorRafael J. Wysocki <rjw@sisk.pl>
Tue, 17 Jul 2007 11:03:35 +0000 (04:03 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 17 Jul 2007 17:23:02 +0000 (10:23 -0700)
commit831441862956fffa17b9801db37e6ea1650b0f69
treeb0334921341f8f1734bdd3243de76d676329d21c
parent787d2214c19bcc9b6ac48af0ce098277a801eded
Freezer: make kernel threads nonfreezable by default

Currently, the freezer treats all tasks as freezable, except for the kernel
threads that explicitly set the PF_NOFREEZE flag for themselves.  This
approach is problematic, since it requires every kernel thread to either
set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
care for the freezing of tasks at all.

It seems better to only require the kernel threads that want to or need to
be frozen to use some freezer-related code and to remove any
freezer-related code from the other (nonfreezable) kernel threads, which is
done in this patch.

The patch causes all kernel threads to be nonfreezable by default (ie.  to
have PF_NOFREEZE set by default) and introduces the set_freezable()
function that should be called by the freezable kernel threads in order to
unset PF_NOFREEZE.  It also makes all of the currently freezable kernel
threads call set_freezable(), so it shouldn't cause any (intentional)
change of behaviour to appear.  Additionally, it updates documentation to
describe the freezing of tasks more accurately.

[akpm@linux-foundation.org: build fixes]
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Nigel Cunningham <nigel@nigel.suspend2.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
65 files changed:
Documentation/power/freezing-of-tasks.txt [new file with mode: 0644]
Documentation/power/kernel_threads.txt [deleted file]
Documentation/power/swsusp.txt
arch/i386/kernel/apm.c
arch/i386/kernel/io_apic.c
drivers/block/loop.c
drivers/block/pktcdvd.c
drivers/char/apm-emulation.c
drivers/char/hvc_console.c
drivers/edac/edac_mc.c
drivers/ieee1394/ieee1394_core.c
drivers/ieee1394/nodemgr.c
drivers/input/gameport/gameport.c
drivers/input/serio/serio.c
drivers/input/touchscreen/ucb1400_ts.c
drivers/macintosh/therm_adt746x.c
drivers/macintosh/windfarm_core.c
drivers/md/md.c
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/video/cx88/cx88-tvaudio.c
drivers/media/video/msp3400-kthreads.c
drivers/media/video/tvaudio.c
drivers/media/video/video-buf-dvb.c
drivers/media/video/vivi.c
drivers/mfd/ucb1x00-ts.c
drivers/mmc/card/queue.c
drivers/mtd/mtd_blkdevs.c
drivers/mtd/ubi/wl.c
drivers/net/wireless/airo.c
drivers/net/wireless/libertas/main.c
drivers/pcmcia/cs.c
drivers/pnp/pnpbios/core.c
drivers/scsi/libsas/sas_scsi_host.c
drivers/scsi/scsi_error.c
drivers/usb/atm/ueagle-atm.c
drivers/usb/core/hub.c
drivers/usb/gadget/file_storage.c
drivers/usb/storage/usb.c
drivers/video/ps3fb.c
drivers/w1/w1.c
fs/cifs/cifsfs.c
fs/cifs/connect.c
fs/jffs2/background.c
fs/lockd/svc.c
fs/nfs/callback.c
fs/nfsd/nfssvc.c
fs/xfs/linux-2.6/xfs_super.c
include/linux/freezer.h
init/do_mounts_initrd.c
kernel/audit.c
kernel/exit.c
kernel/fork.c
kernel/rcutorture.c
kernel/rtmutex-tester.c
kernel/sched.c
kernel/softirq.c
kernel/softlockup.c
kernel/workqueue.c
mm/pdflush.c
mm/vmscan.c
net/bluetooth/bnep/core.c
net/bluetooth/cmtp/core.c
net/bluetooth/hidp/core.c
net/bluetooth/rfcomm/core.c
net/core/pktgen.c