]> git.karo-electronics.de Git - karo-tx-linux.git/commit
PM / Hibernate: Freeze kernel threads after preallocating memory
authorRafael J. Wysocki <rjw@sisk.pl>
Mon, 26 Sep 2011 18:32:27 +0000 (20:32 +0200)
committerRafael J. Wysocki <rjw@sisk.pl>
Mon, 26 Sep 2011 18:32:27 +0000 (20:32 +0200)
commita960e7391cbf84c2ab74b31a2f92f1f92279c4b5
treed956f05ed96c0c1539ef905132770bc3c384125c
parentd12d9c09282ada5fcffd5772f40b6dab48f1e7b1
PM / Hibernate: Freeze kernel threads after preallocating memory

There is a problem with the current ordering of hibernate code which
leads to deadlocks in some filesystems' memory shrinkers.  Namely,
some filesystems use freezable kernel threads that are inactive when
the hibernate memory preallocation is carried out.  Those same
filesystems use memory shrinkers that may be triggered by the
hibernate memory preallocation.  If those memory shrinkers wait for
the frozen kernel threads, the hibernate process deadlocks (this
happens with XFS, for one example).

Apparently, it is not technically viable to redesign the filesystems
in question to avoid the situation described above, so the only
possible solution of this issue is to defer the freezing of kernel
threads until the hibernate memory preallocation is done, which is
implemented by this change.

Unfortunately, this requires the memory preallocation to be done
before the "prepare" stage of device freeze, so after this change the
only way drivers can allocate additional memory for their freeze
routines in a clean way is to use PM notifiers.

Reported-by: Christoph <cr2005@u-club.de>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Documentation/power/devices.txt
include/linux/freezer.h
kernel/power/hibernate.c
kernel/power/power.h
kernel/power/process.c