1. 18 7月, 2007 1 次提交
    • R
      Freezer: make kernel threads nonfreezable by default · 83144186
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NNigel 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: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      83144186
  2. 24 5月, 2007 4 次提交
  3. 14 12月, 2006 1 次提交
    • R
      [PATCH] PM: Fix SMP races in the freezer · 8a102eed
      Rafael J. Wysocki 提交于
      Currently, to tell a task that it should go to the refrigerator, we set the
      PF_FREEZE flag for it and send a fake signal to it.  Unfortunately there
      are two SMP-related problems with this approach.  First, a task running on
      another CPU may be updating its flags while the freezer attempts to set
      PF_FREEZE for it and this may leave the task's flags in an inconsistent
      state.  Second, there is a potential race between freeze_process() and
      refrigerator() in which freeze_process() running on one CPU is reading a
      task's PF_FREEZE flag while refrigerator() running on another CPU has just
      set PF_FROZEN for the same task and attempts to reset PF_FREEZE for it.  If
      the refrigerator wins the race, freeze_process() will state that PF_FREEZE
      hasn't been set for the task and will set it unnecessarily, so the task
      will go to the refrigerator once again after it's been thawed.
      
      To solve first of these problems we need to stop using PF_FREEZE to tell
      tasks that they should go to the refrigerator.  Instead, we can introduce a
      special TIF_*** flag and use it for this purpose, since it is allowed to
      change the other tasks' TIF_*** flags and there are special calls for it.
      
      To avoid the freeze_process()-refrigerator() race we can make
      freeze_process() to always check the task's PF_FROZEN flag after it's read
      its "freeze" flag.  We should also make sure that refrigerator() will
      always reset the task's "freeze" flag after it's set PF_FROZEN for it.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andi Kleen <ak@muc.de>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      8a102eed
  4. 11 12月, 2006 1 次提交
    • R
      [PATCH] freezer.h uses task_struct fields · 5c543eff
      Randy Dunlap 提交于
      freezer.h uses task_struct fields so it should include sched.h.
      
        CC [M]  fs/jfs/jfs_txnmgr.o
      In file included from fs/jfs/jfs_txnmgr.c:49:
      include/linux/freezer.h: In function 'frozen':
      include/linux/freezer.h:9: error: dereferencing pointer to incomplete type
      include/linux/freezer.h:9: error: 'PF_FROZEN' undeclared (first use in this function)
      include/linux/freezer.h:9: error: (Each undeclared identifier is reported only once
      include/linux/freezer.h:9: error: for each function it appears in.)
      include/linux/freezer.h: In function 'freezing':
      include/linux/freezer.h:17: error: dereferencing pointer to incomplete type
      include/linux/freezer.h:17: error: 'PF_FREEZE' undeclared (first use in this function)
      include/linux/freezer.h: In function 'freeze':
      include/linux/freezer.h:26: error: dereferencing pointer to incomplete type
      include/linux/freezer.h:26: error: 'PF_FREEZE' undeclared (first use in this function)
      include/linux/freezer.h: In function 'do_not_freeze':
      include/linux/freezer.h:34: error: dereferencing pointer to incomplete type
      include/linux/freezer.h:34: error: 'PF_FREEZE' undeclared (first use in this function)
      include/linux/freezer.h: In function 'thaw_process':
      include/linux/freezer.h:43: error: dereferencing pointer to incomplete type
      include/linux/freezer.h:43: error: 'PF_FROZEN' undeclared (first use in this function)
      include/linux/freezer.h:44: warning: implicit declaration of function 'wake_up_process'
      include/linux/freezer.h: In function 'frozen_process':
      include/linux/freezer.h:55: error: dereferencing pointer to incomplete type
      include/linux/freezer.h:55: error: dereferencing pointer to incomplete type
      include/linux/freezer.h:55: error: 'PF_FREEZE' undeclared (first use in this function)
      include/linux/freezer.h:55: error: 'PF_FROZEN' undeclared (first use in this function)
      fs/jfs/jfs_txnmgr.c: In function 'freezing':
      include/linux/freezer.h:18: warning: control reaches end of non-void function
      make[2]: *** [fs/jfs/jfs_txnmgr.o] Error 1
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Acked-by: NDave Kleikamp <shaggy@linux.vnet.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      5c543eff
  5. 08 12月, 2006 3 次提交