+ testing. His efforts have contributed as much to TuxOnIce as any of the
+ names above.
diff --git a/MAINTAINERS b/MAINTAINERS
-index 56a2f67..ec6fa04 100644
+index 3596d17..3e7e5ce 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
-@@ -4045,6 +4045,13 @@ P: Maciej W. Rozycki
+@@ -4100,6 +4100,13 @@ P: Maciej W. Rozycki
M: macro@linux-mips.org
S: Maintained
U14-34F SCSI DRIVER
P: Dario Ballabio
M: ballabio_dario@emc.com
-diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
-index 8bcb6f4..529200c 100644
---- a/arch/x86/mm/fault.c
-+++ b/arch/x86/mm/fault.c
-@@ -25,6 +25,7 @@
- #include <linux/kprobes.h>
- #include <linux/uaccess.h>
- #include <linux/kdebug.h>
-+#include <linux/suspend.h>
-
- #include <asm/system.h>
- #include <asm/desc.h>
-@@ -49,6 +50,11 @@
- #define PF_RSVD (1<<3)
- #define PF_INSTR (1<<4)
-
-+#ifdef CONFIG_X86_32
-+int toi_faulted;
-+EXPORT_SYMBOL_GPL(toi_faulted);
-+#endif
-+
- static inline int notify_page_fault(struct pt_regs *regs)
- {
- #ifdef CONFIG_KPROBES
-@@ -604,6 +610,22 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
-
- si_code = SEGV_MAPERR;
-
-+ /* During a TuxOnIce atomic copy, with DEBUG_SLAB, we will
-+ * get page faults where slab has been unmapped. Map them
-+ * temporarily and set the variable that tells TuxOnIce to
-+ * unmap afterwards.
-+ */
-+
-+#ifdef CONFIG_DEBUG_PAGEALLOC /* X86_32 only */
-+ if (unlikely(toi_running && !toi_faulted)) {
-+ struct page *page = NULL;
-+ toi_faulted = 1;
-+ page = virt_to_page(address);
-+ kernel_map_pages(page, 1, 1);
-+ return;
-+ }
-+#endif
-+
- if (notify_page_fault(regs))
- return;
-
diff --git a/crypto/Kconfig b/crypto/Kconfig
-index 864456c..ecbebab 100644
+index d831859..59dbd07 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
-@@ -614,6 +614,14 @@ config CRYPTO_LZO
+@@ -666,6 +666,14 @@ config CRYPTO_LZO
help
This is the LZO algorithm.
endif # if CRYPTO
diff --git a/crypto/Makefile b/crypto/Makefile
-index ca02441..819b2cc 100644
+index d4f3ed8..fe05a9e 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
-@@ -62,6 +62,7 @@ obj-$(CONFIG_CRYPTO_SALSA20) += salsa20_generic.o
+@@ -67,6 +67,7 @@ obj-$(CONFIG_CRYPTO_SALSA20) += salsa20_generic.o
obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o
obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o
obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("LZF Compression Algorithm");
+MODULE_AUTHOR("Marc Alexander Lehmann & Nigel Cunningham");
+diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
+index 273a944..37c1e9f 100644
+--- a/drivers/base/power/main.c
++++ b/drivers/base/power/main.c
+@@ -54,6 +54,7 @@ void device_pm_lock(void)
+ {
+ mutex_lock(&dpm_list_mtx);
+ }
++EXPORT_SYMBOL(device_pm_lock);
+
+ /**
+ * device_pm_unlock - unlock the list of active devices used by the PM core
+@@ -62,6 +63,7 @@ void device_pm_unlock(void)
+ {
+ mutex_unlock(&dpm_list_mtx);
+ }
++EXPORT_SYMBOL(device_pm_unlock);
+
+ /**
+ * device_pm_add - add a device to the list of active devices
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
-index d6365a9..03e1eff 100644
+index d524dc2..681972e 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
-@@ -39,7 +39,6 @@
+@@ -40,7 +40,6 @@
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/sysdev.h>
#include <linux/suspend.h>
#include <linux/cpu.h>
diff --git a/drivers/md/md.c b/drivers/md/md.c
-index 2580ac1..4c20dab 100644
+index deeac4b..cbf1e49 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
-@@ -5730,6 +5730,8 @@ void md_do_sync(mddev_t *mddev)
+@@ -5899,6 +5899,8 @@ void md_do_sync(mddev_t *mddev)
last_mark = next;
}
if (kthread_should_stop())
goto interrupted;
diff --git a/fs/buffer.c b/fs/buffer.c
-index 0f51c0f..cebc137 100644
+index ac78d4c..3a927e2 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -247,6 +247,91 @@ void thaw_bdev(struct block_device *bdev, struct super_block *sb)
if (nbytes < sizeof(struct fuse_out_header))
return -EINVAL;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
-index 2060bf0..9e23548 100644
+index fd03330..347e054 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -7,12 +7,14 @@
#if BITS_PER_LONG >= 64
static inline void fuse_dentry_settime(struct dentry *entry, u64 time)
-@@ -176,6 +178,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
+@@ -174,6 +176,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
return 0;
fc = get_fuse_conn(inode);
req = fuse_get_req(fc);
if (IS_ERR(req))
return 0;
-@@ -271,6 +276,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
+@@ -273,6 +278,8 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name,
if (IS_ERR(req))
- return ERR_CAST(req);
+ goto out;
-+ FUSE_MIGHT_FREEZE(dir->i_sb, "fuse_lookup");
++ FUSE_MIGHT_FREEZE(sb, "fuse_lookup");
+
forget_req = fuse_get_req(fc);
+ err = PTR_ERR(forget_req);
if (IS_ERR(forget_req)) {
- fuse_put_request(fc, req);
-@@ -361,6 +368,8 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
+@@ -402,6 +409,8 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
if (IS_ERR(forget_req))
return PTR_ERR(forget_req);
req = fuse_get_req(fc);
err = PTR_ERR(req);
if (IS_ERR(req))
-@@ -447,6 +456,8 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
+@@ -488,6 +497,8 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
int err;
struct fuse_req *forget_req;
forget_req = fuse_get_req(fc);
if (IS_ERR(forget_req)) {
fuse_put_request(fc, req);
-@@ -544,7 +555,11 @@ static int fuse_mkdir(struct inode *dir, struct dentry *entry, int mode)
+@@ -585,7 +596,11 @@ static int fuse_mkdir(struct inode *dir, struct dentry *entry, int mode)
{
struct fuse_mkdir_in inarg;
struct fuse_conn *fc = get_fuse_conn(dir);
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -564,7 +579,11 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry,
+@@ -605,7 +620,11 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry,
{
struct fuse_conn *fc = get_fuse_conn(dir);
unsigned len = strlen(link) + 1;
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -581,7 +600,11 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
+@@ -622,7 +641,11 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
{
int err;
struct fuse_conn *fc = get_fuse_conn(dir);
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -612,7 +635,11 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
+@@ -653,7 +676,11 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
{
int err;
struct fuse_conn *fc = get_fuse_conn(dir);
return PTR_ERR(req);
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
-index 8092f0d..813c656 100644
+index 2bada6b..2e4af49 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -7,11 +7,13 @@
req = fuse_get_req(fc);
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -1345,6 +1355,8 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
+@@ -1350,6 +1360,8 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
if (fl->fl_flags & FL_CLOSE)
return 0;
req = fuse_get_req(fc);
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -1409,6 +1421,8 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
+@@ -1416,6 +1428,8 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
if (!inode->i_sb->s_bdev || fc->no_bmap)
return 0;
+ } \
+} while (0)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
-index 3141690..c826200 100644
+index d2249f1..04ae6cb 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
-@@ -739,7 +739,7 @@ static int fuse_get_sb(struct file_system_type *fs_type,
+@@ -914,7 +914,7 @@ static int fuse_get_sb(struct file_system_type *fs_type,
static struct file_system_type fuse_fs_type = {
.owner = THIS_MODULE,
.name = "fuse",
.get_sb = fuse_get_sb,
.kill_sb = kill_anon_super,
};
-@@ -758,7 +758,7 @@ static struct file_system_type fuseblk_fs_type = {
+@@ -933,7 +933,7 @@ static struct file_system_type fuseblk_fs_type = {
.name = "fuseblk",
.get_sb = fuse_get_sb_blk,
.kill_sb = kill_block_super,
}
+EXPORT_SYMBOL(sys_ioctl);
diff --git a/fs/namei.c b/fs/namei.c
-index 01e67dd..aedaedf 100644
+index 4ea63ed..65be6a6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
-@@ -2314,6 +2314,8 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
+@@ -2223,6 +2223,8 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
if (!dir->i_op || !dir->i_op->unlink)
return -EPERM;
DQUOT_INIT(dir);
mutex_lock(&dentry->d_inode->i_mutex);
-diff --git a/include/asm-powerpc/suspend.h b/include/asm-powerpc/suspend.h
-index cbf2c94..e0756c2 100644
---- a/include/asm-powerpc/suspend.h
-+++ b/include/asm-powerpc/suspend.h
-@@ -6,4 +6,7 @@ static inline int arch_prepare_suspend(void) { return 0; }
- void save_processor_state(void);
- void restore_processor_state(void);
-
-+#define toi_faulted (0)
-+#define clear_toi_fault() do { } while (0)
-+
- #endif /* __ASM_POWERPC_SUSPEND_H */
-diff --git a/include/asm-ppc/suspend.h b/include/asm-ppc/suspend.h
-index 3df9f32..1e2e73d 100644
---- a/include/asm-ppc/suspend.h
-+++ b/include/asm-ppc/suspend.h
-@@ -10,3 +10,6 @@ static inline void save_processor_state(void)
- static inline void restore_processor_state(void)
- {
- }
-+
-+#define toi_faulted (0)
-+#define clear_toi_fault() do { } while (0)
-diff --git a/include/asm-x86/suspend_32.h b/include/asm-x86/suspend_32.h
-index 24e1c08..441efd6 100644
---- a/include/asm-x86/suspend_32.h
-+++ b/include/asm-x86/suspend_32.h
-@@ -8,6 +8,9 @@
-
- static inline int arch_prepare_suspend(void) { return 0; }
-
-+extern int toi_faulted;
-+#define clear_toi_fault() do { toi_faulted = 0; } while (0)
-+
- /* image of the saved processor state */
- struct saved_context {
- u16 es, fs, gs, ss;
-diff --git a/include/asm-x86/suspend_64.h b/include/asm-x86/suspend_64.h
-index dc3262b..5ff82a1 100644
---- a/include/asm-x86/suspend_64.h
-+++ b/include/asm-x86/suspend_64.h
-@@ -14,6 +14,9 @@ static inline int arch_prepare_suspend(void)
- return 0;
- }
-
-+#define toi_faulted (0)
-+#define clear_toi_fault() do { } while (0)
-+
- /*
- * Image of the saved processor state, used by the low level ACPI suspend to
- * RAM code and by the low level hibernation code.
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
-index 71d70d1..b5de633 100644
+index b68ec09..6eebd34 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
-@@ -207,6 +207,7 @@ unifdef-y += filter.h
+@@ -208,6 +208,7 @@ unifdef-y += filter.h
unifdef-y += flat.h
unifdef-y += futex.h
unifdef-y += fs.h
unifdef-y += generic_serial.h
unifdef-y += hayesesp.h
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
-index 82aa36c..ee09d61 100644
+index eadaab4..7eb6655 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
-@@ -172,6 +172,11 @@ wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
+@@ -171,6 +171,11 @@ wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
int fsync_bdev(struct block_device *);
struct super_block *freeze_bdev(struct block_device *);
void thaw_bdev(struct block_device *, struct super_block *);
+#endif
+#endif
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
-index 0893499..01e9dc6 100644
+index deddeed..4d92953 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -127,6 +127,19 @@ static inline void set_freezable(void)
+extern void thaw_kernel_threads(void);
+
/*
- * Freezer-friendly wrappers around wait_event_interruptible() and
- * wait_event_interruptible_timeout(), originally defined in <linux/wait.h>
-@@ -169,6 +182,8 @@ static inline int freeze_processes(void) { BUG(); return 0; }
+ * Tell the freezer that the current task should be frozen by it and that it
+ * should send a fake signal to the task to freeze it.
+@@ -178,6 +191,8 @@ static inline int freeze_processes(void) { BUG(); return 0; }
static inline void thaw_processes(void) {}
static inline int try_to_freeze(void) { return 0; }
static inline void freezer_do_not_count(void) {}
static inline void freezer_count(void) {}
diff --git a/include/linux/fs.h b/include/linux/fs.h
-index d8e2762..7db243f 100644
+index 580b513..e7a3169 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -8,6 +8,7 @@
/*
* It's silly to have NR_OPEN bigger than NR_FILE, but you can change
-@@ -94,6 +95,7 @@ extern int dir_notify_enable;
+@@ -96,6 +97,7 @@ extern int dir_notify_enable;
#define FS_REQUIRES_DEV 1
#define FS_BINARY_MOUNTDATA 2
#define FS_HAS_SUBTYPE 4
#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move()
* during rename() internally.
-@@ -126,6 +128,7 @@ extern int dir_notify_enable;
+@@ -128,6 +130,7 @@ extern int dir_notify_enable;
#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
#define MS_I_VERSION (1<<23) /* Update inode I_version field */
#define MS_ACTIVE (1<<30)
#define MS_NOUSER (1<<31)
-@@ -1105,8 +1108,11 @@ enum {
+@@ -1141,8 +1144,11 @@ enum {
SB_FREEZE_TRANS = 2,
};
#define get_fs_excl() atomic_inc(¤t->fs_excl)
#define put_fs_excl() atomic_dec(¤t->fs_excl)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
-index 2e70006..a43b516 100644
+index 2651f80..c50279d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
-@@ -157,6 +157,8 @@ extern int vsprintf(char *buf, const char *, va_list)
+@@ -165,6 +165,8 @@ extern int vsprintf(char *buf, const char *, va_list)
__attribute__ ((format (printf, 2, 0)));
extern int snprintf(char * buf, size_t size, const char * fmt, ...)
__attribute__ ((format (printf, 3, 4)));
__attribute__ ((format (printf, 3, 0)));
extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
diff --git a/include/linux/mm.h b/include/linux/mm.h
-index 586a943..bd34f82 100644
+index 72a15dc..01a7657 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
-@@ -1244,6 +1244,7 @@ int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
+@@ -1264,6 +1264,7 @@ int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
void __user *, size_t *, loff_t *);
unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
unsigned long lru_pages);
#ifndef CONFIG_MMU
#define randomize_va_space 0
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
-index bec1062..e7f772f 100644
+index 9ff1b54..100dc2e 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -24,6 +24,8 @@
#define MAX_LINKS 32
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
-index a697742..505cfa2 100644
+index 2ce8207..374e892 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
-@@ -266,4 +266,69 @@ static inline void register_nosave_region_late(unsigned long b, unsigned long e)
- }
- #endif
+@@ -280,4 +280,69 @@ static inline void register_nosave_region_late(unsigned long b, unsigned long e)
+
+ extern struct mutex pm_mutex;
+enum {
+ TOI_CAN_HIBERNATE,
+
#endif /* _LINUX_SUSPEND_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
-index 0b33776..5d6433b 100644
+index de40f16..44050a6 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -164,6 +164,7 @@ extern unsigned long totalram_pages;
extern int vm_swappiness;
extern int remove_mapping(struct address_space *mapping, struct page *page);
extern long vm_total_pages;
-@@ -356,5 +359,10 @@ static inline swp_entry_t get_swap_page(void)
+@@ -353,5 +356,10 @@ static inline swp_entry_t get_swap_page(void)
#define disable_swap_token() do { } while(0)
#endif /* CONFIG_SWAP */
#endif /* __KERNEL__*/
#endif /* _LINUX_SWAP_H */
diff --git a/init/do_mounts.c b/init/do_mounts.c
-index 660c1e5..8ea449f 100644
+index 3715feb..0463ea1 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
-@@ -398,6 +398,8 @@ void __init prepare_namespace(void)
+@@ -400,6 +400,8 @@ void __init prepare_namespace(void)
if (is_floppy && rd_doload && rd_load_disk(0))
ROOT_DEV = Root_RAM0;
sys_fchdir(old_fd);
sys_mount("/", ".", NULL, MS_MOVE, NULL);
diff --git a/init/main.c b/init/main.c
-index f7fb200..6746e95 100644
+index f6f7042..038a94f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -57,6 +57,7 @@
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/idr.h>
-@@ -602,6 +603,7 @@ asmlinkage void __init start_kernel(void)
+@@ -607,6 +608,7 @@ asmlinkage void __init start_kernel(void)
softirq_init();
timekeeping_init();
time_init();
sched_clock_init();
profile_init();
if (!irqs_disabled())
-@@ -641,6 +643,7 @@ asmlinkage void __init start_kernel(void)
+@@ -648,6 +650,7 @@ asmlinkage void __init start_kernel(void)
enable_debug_pagealloc();
cpu_hotplug_init();
kmem_cache_init();
idr_init_cache();
setup_per_cpu_pageset();
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
-index b45da40..a74041c 100644
+index dcd165f..7c80422 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -34,6 +34,18 @@ config PM_VERBOSE
config CAN_PM_TRACE
def_bool y
depends on PM_DEBUG && PM_SLEEP && EXPERIMENTAL
-@@ -168,6 +180,272 @@ config PM_STD_PARTITION
+@@ -179,6 +191,272 @@ config PM_STD_PARTITION
suspended image to. It will simply pick the first available swap
device.
obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
-index 14a656c..141606e 100644
+index bbd85c6..2e444e6 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
-@@ -24,9 +24,11 @@
+@@ -25,9 +25,11 @@
#include "power.h"
dev_t swsusp_resume_device;
sector_t swsusp_resume_block;
-@@ -104,7 +106,7 @@ static int hibernation_test(int level) { return 0; }
+@@ -105,7 +107,7 @@ static int hibernation_test(int level) { return 0; }
* hibernation
*/
{
return (platform_mode && hibernation_ops) ?
hibernation_ops->begin() : 0;
-@@ -115,7 +117,7 @@ static int platform_begin(int platform_mode)
+@@ -116,7 +118,7 @@ static int platform_begin(int platform_mode)
* working state
*/
{
if (platform_mode && hibernation_ops)
hibernation_ops->end();
-@@ -126,7 +128,7 @@ static void platform_end(int platform_mode)
+@@ -127,7 +129,7 @@ static void platform_end(int platform_mode)
* platform driver if so configured and return an error code if it fails
*/
{
return (platform_mode && hibernation_ops) ?
hibernation_ops->pre_snapshot() : 0;
-@@ -137,7 +139,7 @@ static int platform_pre_snapshot(int platform_mode)
+@@ -138,7 +140,7 @@ static int platform_pre_snapshot(int platform_mode)
* of operation using the platform driver (called with interrupts disabled)
*/
{
if (platform_mode && hibernation_ops)
hibernation_ops->leave();
-@@ -148,7 +150,7 @@ static void platform_leave(int platform_mode)
+@@ -149,7 +151,7 @@ static void platform_leave(int platform_mode)
* using the platform driver (must be called after platform_prepare())
*/
{
if (platform_mode && hibernation_ops)
hibernation_ops->finish();
-@@ -160,7 +162,7 @@ static void platform_finish(int platform_mode)
+@@ -161,7 +163,7 @@ static void platform_finish(int platform_mode)
* called, platform_restore_cleanup() must be called.
*/
{
return (platform_mode && hibernation_ops) ?
hibernation_ops->pre_restore() : 0;
-@@ -173,7 +175,7 @@ static int platform_pre_restore(int platform_mode)
+@@ -174,7 +176,7 @@ static int platform_pre_restore(int platform_mode)
* regardless of the result of platform_pre_restore().
*/
{
if (platform_mode && hibernation_ops)
hibernation_ops->restore_cleanup();
-@@ -477,6 +479,11 @@ int hibernate(void)
+@@ -508,6 +510,11 @@ int hibernate(void)
{
int error;
mutex_lock(&pm_mutex);
/* The snapshot device should not be opened while we're running */
if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
-@@ -549,10 +556,21 @@ int hibernate(void)
+@@ -580,10 +587,21 @@ int hibernate(void)
*
*/
/*
* name_to_dev_t() below takes a sysfs buffer mutex when sysfs
-@@ -565,6 +583,7 @@ static int software_resume(void)
+@@ -596,6 +614,7 @@ static int software_resume(void)
* here to avoid lockdep complaining.
*/
mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING);
if (!swsusp_resume_device) {
if (!strlen(resume_file)) {
mutex_unlock(&pm_mutex);
-@@ -636,9 +655,6 @@ static int software_resume(void)
+@@ -667,9 +686,6 @@ static int software_resume(void)
return error;
}
static const char * const hibernation_modes[] = {
[HIBERNATION_PLATFORM] = "platform",
[HIBERNATION_SHUTDOWN] = "shutdown",
-@@ -851,6 +867,7 @@ static int __init resume_offset_setup(char *str)
+@@ -882,6 +898,7 @@ static int __init resume_offset_setup(char *str)
static int __init noresume_setup(char *str)
{
noresume = 1;
}
diff --git a/kernel/power/power.h b/kernel/power/power.h
-index 700f44e..fdc558a 100644
+index acc0c10..6a4a5b4 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -1,7 +1,16 @@
/*
* Keep some memory free so that I/O operations can succeed without paging
* [Might this be more than 4 MB?]
-@@ -65,6 +78,8 @@ static struct kobj_attribute _name##_attr = { \
+@@ -63,6 +76,8 @@ static struct kobj_attribute _name##_attr = { \
.store = _name##_store, \
}
/* Preferred image size in bytes (default 500 MB) */
extern unsigned long image_size;
extern int in_suspend;
-@@ -225,3 +240,26 @@ static inline void suspend_thaw_processes(void)
+@@ -223,3 +238,26 @@ static inline void suspend_thaw_processes(void)
{
}
#endif
+
+#endif
diff --git a/kernel/power/process.c b/kernel/power/process.c
-index f1d0b34..b835412 100644
+index 278946a..ba2eb75 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -13,6 +13,10 @@
/*
* Timeout for stopping processes
-@@ -74,6 +78,7 @@ void refrigerator(void)
- pr_debug("%s left refrigerator\n", current->comm);
- __set_current_state(save);
- }
-+EXPORT_SYMBOL(refrigerator);
-
- static void fake_signal_wake_up(struct task_struct *p)
- {
-@@ -214,7 +219,8 @@ static int try_to_freeze_tasks(int freeze_user_space)
+@@ -201,7 +205,8 @@ static int try_to_freeze_tasks(bool sig_only)
do_each_thread(g, p) {
task_lock(p);
if (freezing(p) && !freezer_should_skip(p))
cancel_freezing(p);
task_unlock(p);
} while_each_thread(g, p);
-@@ -234,17 +240,25 @@ int freeze_processes(void)
+@@ -221,17 +226,25 @@ int freeze_processes(void)
{
int error;
+ freeze_filesystems(FS_FREEZER_FUSE);
+ freezer_state = FREEZER_FILESYSTEMS_FROZEN;
+ printk(KERN_INFO "Freezing user space processes ... ");
- error = try_to_freeze_tasks(FREEZER_USER_SPACE);
+ error = try_to_freeze_tasks(true);
if (error)
goto Exit;
- printk("done.\n");
+ freeze_filesystems(FS_FREEZER_NORMAL);
+ freezer_state = FREEZER_USERSPACE_FROZEN;
+ printk(KERN_INFO "Freezing remaining freezable tasks ... ");
- error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
+ error = try_to_freeze_tasks(false);
if (error)
goto Exit;
printk("done.");
Exit:
BUG_ON(in_atomic());
printk("\n");
-@@ -270,11 +284,33 @@ static void thaw_tasks(int thaw_user_space)
+@@ -257,11 +270,35 @@ static void thaw_tasks(bool nosig_only)
void thaw_processes(void)
{
- printk("Restarting tasks ... ");
-- thaw_tasks(FREEZER_KERNEL_THREADS);
+- thaw_tasks(true);
+ int old_state = freezer_state;
+
+ if (old_state == FREEZER_OFF)
+ printk(KERN_INFO "Restarting tasks ... ");
+
+ if (old_state == FREEZER_FULLY_ON)
-+ thaw_tasks(FREEZER_KERNEL_THREADS);
- thaw_tasks(FREEZER_USER_SPACE);
++ thaw_tasks(true);
+ thaw_tasks(false);
schedule();
printk("done.\n");
}
--EXPORT_SYMBOL(refrigerator);
+ EXPORT_SYMBOL(refrigerator);
++
+void thaw_kernel_threads(void)
+{
+ freezer_state = FREEZER_USERSPACE_FROZEN;
+ printk(KERN_INFO "Restarting normal filesystems.\n");
+ thaw_filesystems(FS_FREEZER_NORMAL);
-+ thaw_tasks(FREEZER_KERNEL_THREADS);
++ thaw_tasks(true);
+}
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
-index 5f91a07..5a08d0b 100644
+index 5d2ab83..bdb3071 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -33,6 +33,7 @@
return (unsigned long)get_image_page(gfp_mask, PG_SAFE);
}
-@@ -607,18 +619,8 @@ static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm)
- return bb->start_pfn + chunk * BM_BITS_PER_CHUNK + bit;
+@@ -561,18 +573,8 @@ static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm)
+ return bb->start_pfn + bit;
}
-/**
/**
* register_nosave_region - register a range of page frames the contents
-@@ -855,7 +857,7 @@ static unsigned int count_free_highmem_pages(void)
+@@ -809,7 +811,7 @@ static unsigned int count_free_highmem_pages(void)
* and it isn't a part of a free chunk of pages.
*/
{
struct page *page;
-@@ -897,8 +899,6 @@ unsigned int count_highmem_pages(void)
+@@ -851,8 +853,6 @@ unsigned int count_highmem_pages(void)
}
return n;
}
#endif /* CONFIG_HIGHMEM */
/**
-@@ -910,7 +910,7 @@ static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; }
+@@ -864,7 +864,7 @@ static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; }
* a free chunk of pages.
*/
{
struct page *page;
-@@ -1244,6 +1244,11 @@ asmlinkage int swsusp_save(void)
+@@ -1198,6 +1198,11 @@ asmlinkage int swsusp_save(void)
{
unsigned int nr_pages, nr_highmem;
printk(KERN_INFO "PM: Creating hibernation image: \n");
drain_local_pages(NULL);
-@@ -1284,14 +1289,14 @@ asmlinkage int swsusp_save(void)
+@@ -1238,14 +1243,14 @@ asmlinkage int swsusp_save(void)
}
#ifndef CONFIG_ARCH_HIBERNATION_HEADER
{
if (info->version_code != LINUX_VERSION_CODE)
return "kernel version";
-@@ -1305,6 +1310,7 @@ static char *check_image_kernel(struct swsusp_info *info)
+@@ -1259,6 +1264,7 @@ static char *check_image_kernel(struct swsusp_info *info)
return "machine";
return NULL;
}
#endif /* CONFIG_ARCH_HIBERNATION_HEADER */
unsigned long snapshot_get_image_size(void)
-@@ -1312,7 +1318,7 @@ unsigned long snapshot_get_image_size(void)
+@@ -1266,7 +1272,7 @@ unsigned long snapshot_get_image_size(void)
return nr_copy_pages + nr_meta_pages + 1;
}
{
memset(info, 0, sizeof(struct swsusp_info));
info->num_physpages = num_physpages;
-@@ -1320,7 +1326,7 @@ static int init_header(struct swsusp_info *info)
+@@ -1274,7 +1280,7 @@ static int init_header(struct swsusp_info *info)
info->pages = snapshot_get_image_size();
info->size = info->pages;
info->size <<= PAGE_SHIFT;
}
/**
-@@ -1376,7 +1382,7 @@ int snapshot_read_next(struct snapshot_handle *handle, size_t count)
+@@ -1330,7 +1336,7 @@ int snapshot_read_next(struct snapshot_handle *handle, size_t count)
if (!handle->offset) {
int error;
if (error)
return error;
handle->buffer = buffer;
-@@ -1473,7 +1479,7 @@ static int check_header(struct swsusp_info *info)
+@@ -1427,7 +1433,7 @@ static int check_header(struct swsusp_info *info)
{
char *reason;
+#endif
diff --git a/kernel/power/tuxonice_atomic_copy.c b/kernel/power/tuxonice_atomic_copy.c
new file mode 100644
-index 0000000..6a15805
+index 0000000..e2f0c2a
--- /dev/null
+++ b/kernel/power/tuxonice_atomic_copy.c
-@@ -0,0 +1,379 @@
+@@ -0,0 +1,384 @@
+/*
+ * kernel/power/tuxonice_atomic_copy.c
+ *
+ for (i = 0; i < pagedir1.size; i++) {
+ unsigned long *origvirt, *copyvirt;
+ struct page *origpage, *copypage;
-+ int loop = (PAGE_SIZE / sizeof(unsigned long)) - 1;
++ int loop = (PAGE_SIZE / sizeof(unsigned long)) - 1,
++ was_present;
+
+ origpage = pfn_to_page(source_index);
+ copypage = pfn_to_page(dest_index);
+ kmap_atomic(copypage, KM_USER1) :
+ page_address(copypage);
+
++ was_present = kernel_page_present(origpage);
++ if (!was_present)
++ kernel_map_pages(origpage, 1, 1);
++
+ while (loop >= 0) {
+ *(copyvirt + loop) = *(origvirt + loop);
+ loop--;
+ }
+
++ if (!was_present)
++ kernel_map_pages(origpage, 1, 0);
++
+ if (PageHighMem(origpage))
+ kunmap_atomic(origvirt, KM_USER0);
-+ else if (toi_faulted) {
-+ printk(KERN_INFO "%p (%lu) being unmapped after "
-+ "faulting during atomic copy.\n", origpage,
-+ source_index);
-+ kernel_map_pages(origpage, 1, 0);
-+ clear_toi_fault();
-+ }
+
+ if (PageHighMem(copypage))
+ kunmap_atomic(copyvirt, KM_USER1);
+ if (add_boot_kernel_data_pbe())
+ goto Failed;
+
-+ if (toi_go_atomic(PMSG_PRETHAW, 0))
++ if (toi_go_atomic(PMSG_QUIESCE, 0))
+ goto Failed;
+
+ /* We'll ignore saved state, but this gets preempt count (etc) right */
+
+ if (suspend_time && toi_platform_begin()) {
+ set_abort_result(TOI_PLATFORM_PREP_FAILED);
-+ toi_end_atomic(ATOMIC_STEP_PLATFORM_END, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_PLATFORM_END, suspend_time, 0);
+ return 1;
+ }
+
+
+ if (device_suspend(state)) {
+ set_abort_result(TOI_DEVICE_REFUSED);
-+ toi_end_atomic(ATOMIC_STEP_RESUME_CONSOLE, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_RESUME_CONSOLE, suspend_time, 1);
+ return 1;
+ }
+
+ if (suspend_time && toi_platform_pre_snapshot()) {
+ set_abort_result(TOI_PRE_SNAPSHOT_FAILED);
-+ toi_end_atomic(ATOMIC_STEP_PLATFORM_FINISH, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_PLATFORM_FINISH, suspend_time, 0);
+ return 1;
+ }
+
+ if (!suspend_time && toi_platform_pre_restore()) {
+ set_abort_result(TOI_PRE_RESTORE_FAILED);
-+ toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time, 0);
+ return 1;
+ }
+
+ if (disable_nonboot_cpus()) {
+ set_abort_result(TOI_CPU_HOTPLUG_FAILED);
+ toi_end_atomic(ATOMIC_STEP_CPU_HOTPLUG,
-+ suspend_time);
++ suspend_time, 0);
+ return 1;
+ }
+ }
+
+ if (suspend_time && arch_prepare_suspend()) {
+ set_abort_result(TOI_ARCH_PREPARE_FAILED);
-+ toi_end_atomic(ATOMIC_STEP_CPU_HOTPLUG, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_CPU_HOTPLUG, suspend_time, 0);
+ return 1;
+ }
+
++ device_pm_lock();
+ local_irq_disable();
+
+ /* At this point, device_suspend() has been called, but *not*
+
+ if (device_power_down(state)) {
+ set_abort_result(TOI_DEVICE_REFUSED);
-+ toi_end_atomic(ATOMIC_STEP_IRQS, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_IRQS, suspend_time, 0);
+ return 1;
+ }
+
+ return 0;
+}
+
-+void toi_end_atomic(int stage, int suspend_time)
++void toi_end_atomic(int stage, int suspend_time, int error)
+{
+ switch (stage) {
+ case ATOMIC_ALL_STEPS:
+ if (!suspend_time)
+ toi_platform_leave();
-+ device_power_up();
++ device_power_up(error ? PMSG_RECOVER :
++ (suspend_time ? PMSG_THAW : PMSG_RESTORE));
+ case ATOMIC_STEP_IRQS:
+ local_irq_enable();
++ device_pm_unlock();
+ case ATOMIC_STEP_CPU_HOTPLUG:
+ if (test_action_state(TOI_LATE_CPU_HOTPLUG))
+ enable_nonboot_cpus();
+ case ATOMIC_STEP_PLATFORM_FINISH:
+ toi_platform_finish();
+ case ATOMIC_STEP_DEVICE_RESUME:
-+ device_resume();
++ device_resume(error ? PMSG_RECOVER :
++ (suspend_time ? PMSG_THAW : PMSG_RESTORE));
+ case ATOMIC_STEP_RESUME_CONSOLE:
+ resume_console();
+ case ATOMIC_STEP_PLATFORM_END:
+}
diff --git a/kernel/power/tuxonice_atomic_copy.h b/kernel/power/tuxonice_atomic_copy.h
new file mode 100644
-index 0000000..a57e254
+index 0000000..7ec08a8
--- /dev/null
+++ b/kernel/power/tuxonice_atomic_copy.h
@@ -0,0 +1,22 @@
+};
+
+int toi_go_atomic(pm_message_t state, int toi_time);
-+void toi_end_atomic(int stage, int toi_time);
++void toi_end_atomic(int stage, int toi_time, int error);
diff --git a/kernel/power/tuxonice_block_io.c b/kernel/power/tuxonice_block_io.c
new file mode 100644
index 0000000..b018914
+#endif
diff --git a/kernel/power/tuxonice_highlevel.c b/kernel/power/tuxonice_highlevel.c
new file mode 100644
-index 0000000..bbaeac2
+index 0000000..f233f24
--- /dev/null
+++ b/kernel/power/tuxonice_highlevel.c
@@ -0,0 +1,1328 @@
+ did_copy = 1;
+
+ /* We return here at resume time too! */
-+ toi_end_atomic(ATOMIC_ALL_STEPS, toi_in_hibernate);
++ toi_end_atomic(ATOMIC_ALL_STEPS, toi_in_hibernate, temp_result);
+
+Failed:
+ if (toi_activate_storage(1))
+#endif
diff --git a/kernel/power/tuxonice_netlink.c b/kernel/power/tuxonice_netlink.c
new file mode 100644
-index 0000000..cc328e5
+index 0000000..fd9e9c1
--- /dev/null
+++ b/kernel/power/tuxonice_netlink.c
@@ -0,0 +1,327 @@
+ netlink_unicast(uhd->nl, skb, uhd->pid, 0);
+
+ read_lock(&tasklist_lock);
-+ t = find_task_by_pid(uhd->pid);
++ t = find_task_by_pid_type_ns(PIDTYPE_PID, uhd->pid, &init_pid_ns);
+ if (!t) {
+ read_unlock(&tasklist_lock);
+ if (uhd->pid > -1)
+ struct task_struct *t;
+
+ read_lock(&tasklist_lock);
-+ t = find_task_by_pid(pid);
++ t = find_task_by_pid_type_ns(PIDTYPE_PID, pid, &init_pid_ns);
+ if (!t) {
+ read_unlock(&tasklist_lock);
+ printk(KERN_INFO "Strange. Can't find the userspace task %d.\n",
+ struct task_struct *t;
+
+ read_lock(&tasklist_lock);
-+ t = find_task_by_pid(uhd->pid);
++ t = find_task_by_pid_type_ns(PIDTYPE_PID, uhd->pid, &init_pid_ns);
+ if (t)
+ t->flags &= ~PF_NOFREEZE;
+ read_unlock(&tasklist_lock);
+extern int toi_pageflags_space_needed(void);
diff --git a/kernel/power/tuxonice_power_off.c b/kernel/power/tuxonice_power_off.c
new file mode 100644
-index 0000000..827d59d
+index 0000000..e35736f
--- /dev/null
+++ b/kernel/power/tuxonice_power_off.c
-@@ -0,0 +1,279 @@
+@@ -0,0 +1,284 @@
+/*
+ * kernel/power/tuxonice_power_off.c
+ *
+ break;
+ case 3:
+ error = pm_notifier_call_chain(PM_SUSPEND_PREPARE);
-+ if (!error)
++ if (!error) {
+ error = suspend_devices_and_enter(PM_SUSPEND_MEM);
++ if (!error)
++ did_suspend_to_both = 1;
++ }
+ pm_notifier_call_chain(PM_POST_SUSPEND);
-+ if (!error) {
-+ did_suspend_to_both = 1;
++
++ /* Success - we're now post-resume-from-ram */
++ if (did_suspend_to_both)
+ return;
-+ }
++
++ /* Failed to suspend to ram - do normal power off */
+ break;
+ case 4:
-+ /*
++ /*
+ * If succeeds, doesn't return. If fails, do a simple
+ * powerdown.
+ */
+#define toi_platform_restore_cleanup() platform_restore_cleanup(platform_test())
diff --git a/kernel/power/tuxonice_prepare_image.c b/kernel/power/tuxonice_prepare_image.c
new file mode 100644
-index 0000000..df7d739
+index 0000000..68f2fd3
--- /dev/null
+++ b/kernel/power/tuxonice_prepare_image.c
-@@ -0,0 +1,1054 @@
+@@ -0,0 +1,1056 @@
+/*
+ * kernel/power/tuxonice_prepare_image.c
+ *
+ else {
+ read_lock(&tasklist_lock);
+ for_each_process(p) {
-+ if (!p->mm || (p->flags & PF_BORROWED_MM))
++ if (!p->mm || (p->flags & PF_KTHREAD))
+ continue;
+
+ toi_mark_task_as_pageset(p, PAGESET2);
+
+ suspend_console();
+ device_suspend(PMSG_FREEZE);
++ device_pm_lock();
+ local_irq_disable(); /* irqs might have been re-enabled on us */
+ device_power_down(PMSG_FREEZE);
+
+ final = real_nr_free_pages(all_zones_mask);
+
-+ device_power_up();
++ device_power_up(PMSG_THAW);
+ local_irq_enable();
-+ device_resume();
++ device_pm_unlock();
++ device_resume(PMSG_THAW);
+ resume_console();
+
+ extra_pd1_pages_allowance = max(
+late_initcall(toi_user_ui_init);
+#endif
diff --git a/kernel/printk.c b/kernel/printk.c
-index e2129e8..fc9d16d 100644
+index b51b156..2f4e8da 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -32,6 +32,8 @@
#include <asm/uaccess.h>
-@@ -99,9 +101,12 @@ static DEFINE_SPINLOCK(logbuf_lock);
+@@ -101,9 +103,12 @@ static DEFINE_SPINLOCK(logbuf_lock);
* The indices into log_buf are not constrained to log_buf_len - they
* must be masked before subscripting
*/
/*
* Array of consoles built from command line options (console=)
-@@ -127,10 +132,11 @@ static int console_may_schedule;
+@@ -131,10 +136,11 @@ static int console_may_schedule;
#ifdef CONFIG_PRINTK
static int __init log_buf_len_setup(char *str)
{
-@@ -954,6 +960,7 @@ void suspend_console(void)
+@@ -937,6 +943,7 @@ void suspend_console(void)
acquire_console_sem();
console_suspended = 1;
}
void resume_console(void)
{
-@@ -962,6 +969,7 @@ void resume_console(void)
+@@ -945,6 +952,7 @@ void resume_console(void)
console_suspended = 0;
release_console_sem();
}
/**
* acquire_console_sem - lock the console system for exclusive use.
diff --git a/kernel/timer.c b/kernel/timer.c
-index ceacc66..77f9269 100644
+index 03bc7f1..d70831d 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -37,6 +37,8 @@
#include <asm/uaccess.h>
#include <asm/unistd.h>
-@@ -1010,6 +1012,59 @@ unsigned long avenrun[3];
+@@ -1002,6 +1004,59 @@ unsigned long avenrun[3];
EXPORT_SYMBOL(avenrun);
/*
* calc_load - given tick count, update the avenrun load estimates.
* This is called while holding a write_lock on xtime_lock.
-@@ -1503,6 +1558,7 @@ void __init init_timers(void)
+@@ -1495,6 +1550,7 @@ void __init init_timers(void)
BUG_ON(err == NOTIFY_BAD);
register_cpu_notifier(&timers_nb);
- open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL);
+ open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
+ register_pm_notifier_callback();
}
/**
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
-index 1dc2d1d..be5fc0b 100644
+index c399bc1..42e7072 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
-@@ -567,6 +567,29 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field
+@@ -558,6 +558,29 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field
return number(buf, end, (unsigned long) ptr, 16, field_width, precision, flags);
}
* vsnprintf - Format a string and place it in a buffer
* @buf: The buffer to place the result into
diff --git a/mm/Makefile b/mm/Makefile
-index 18c143b..bbd52ae 100644
+index da4ccf0..40d7f55 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -11,7 +11,7 @@ obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
maccess.o page_alloc.o page-writeback.o pdflush.o \
readahead.o swap.o truncate.o vmscan.o \
prio_tree.o util.o mmzone.o vmstat.o backing-dev.o \
-- page_isolation.o $(mmu-y)
-+ dyn_pageflags.o page_isolation.o $(mmu-y)
+- page_isolation.o mm_init.o $(mmu-y)
++ dyn_pageflags.o page_isolation.o mm_init.o $(mmu-y)
obj-$(CONFIG_PROC_PAGE_MONITOR) += pagewalk.o
obj-$(CONFIG_BOUNCE) += bounce.o
+
+__setup("dyn_pageflags_debug", dyn_pageflags_debug_setup);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
-index 833f854..5bd8e4c 100644
+index 89fee2d..bb289fd 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -213,6 +213,8 @@ static int __add_zone(struct zone *zone, unsigned long phys_start_pfn)
}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
-index f32fae3..2dd58f1 100644
+index 27b8681..6a707ed 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
-@@ -1731,6 +1731,26 @@ static unsigned int nr_free_zone_pages(int offset)
+@@ -1777,6 +1777,26 @@ static unsigned int nr_free_zone_pages(int offset)
return sum;
}
/*
* Amount of free RAM allocatable within ZONE_DMA and ZONE_NORMAL
*/
-@@ -1741,6 +1761,15 @@ unsigned int nr_free_buffer_pages(void)
+@@ -1787,6 +1807,15 @@ unsigned int nr_free_buffer_pages(void)
EXPORT_SYMBOL_GPL(nr_free_buffer_pages);
/*
*/
unsigned int nr_free_pagecache_pages(void)
diff --git a/mm/vmscan.c b/mm/vmscan.c
-index 967d30c..2ace4cb 100644
+index 1ff1a58..c02c6e6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
-@@ -776,6 +776,28 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
+@@ -811,6 +811,28 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
return nr_taken;
}
static unsigned long isolate_pages_global(unsigned long nr,
struct list_head *dst,
unsigned long *scanned, int order,
-@@ -826,7 +848,6 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
+@@ -861,7 +883,6 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
lru_add_drain();
spin_lock_irq(&zone->lru_lock);
do {
unsigned long nr_taken;
unsigned long nr_scan;
unsigned long nr_freed;
-@@ -888,21 +909,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
+@@ -923,21 +944,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
/*
* Put back any unfreeable pages.
*/
} while (nr_scanned < max_scan);
spin_unlock(&zone->lru_lock);
done:
-@@ -1626,6 +1633,72 @@ out:
+@@ -1665,6 +1672,72 @@ out:
return nr_reclaimed;
}
/*
* The background pageout daemon, started as a kernel thread
* from the init process.
-@@ -1710,6 +1783,9 @@ void wakeup_kswapd(struct zone *zone, int order)
+@@ -1749,6 +1822,9 @@ void wakeup_kswapd(struct zone *zone, int order)
if (!populated_zone(zone))
return;
pgdat = zone->zone_pgdat;
if (zone_watermark_ok(zone, order, zone->pages_low, 0, 0))
return;
-@@ -1723,6 +1799,109 @@ void wakeup_kswapd(struct zone *zone, int order)
+@@ -1762,6 +1838,109 @@ void wakeup_kswapd(struct zone *zone, int order)
}
#ifdef CONFIG_PM
+ testing. His efforts have contributed as much to TuxOnIce as any of the
+ names above.
diff --git a/MAINTAINERS b/MAINTAINERS
-index 56a2f67..ec6fa04 100644
+index 3596d17..3e7e5ce 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
-@@ -4045,6 +4045,13 @@ P: Maciej W. Rozycki
+@@ -4100,6 +4100,13 @@ P: Maciej W. Rozycki
M: macro@linux-mips.org
S: Maintained
U14-34F SCSI DRIVER
P: Dario Ballabio
M: ballabio_dario@emc.com
-diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
-index 8bcb6f4..529200c 100644
---- a/arch/x86/mm/fault.c
-+++ b/arch/x86/mm/fault.c
-@@ -25,6 +25,7 @@
- #include <linux/kprobes.h>
- #include <linux/uaccess.h>
- #include <linux/kdebug.h>
-+#include <linux/suspend.h>
-
- #include <asm/system.h>
- #include <asm/desc.h>
-@@ -49,6 +50,11 @@
- #define PF_RSVD (1<<3)
- #define PF_INSTR (1<<4)
-
-+#ifdef CONFIG_X86_32
-+int toi_faulted;
-+EXPORT_SYMBOL_GPL(toi_faulted);
-+#endif
-+
- static inline int notify_page_fault(struct pt_regs *regs)
- {
- #ifdef CONFIG_KPROBES
-@@ -604,6 +610,22 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
-
- si_code = SEGV_MAPERR;
-
-+ /* During a TuxOnIce atomic copy, with DEBUG_SLAB, we will
-+ * get page faults where slab has been unmapped. Map them
-+ * temporarily and set the variable that tells TuxOnIce to
-+ * unmap afterwards.
-+ */
-+
-+#ifdef CONFIG_DEBUG_PAGEALLOC /* X86_32 only */
-+ if (unlikely(toi_running && !toi_faulted)) {
-+ struct page *page = NULL;
-+ toi_faulted = 1;
-+ page = virt_to_page(address);
-+ kernel_map_pages(page, 1, 1);
-+ return;
-+ }
-+#endif
-+
- if (notify_page_fault(regs))
- return;
-
diff --git a/crypto/Kconfig b/crypto/Kconfig
-index 864456c..ecbebab 100644
+index d831859..59dbd07 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
-@@ -614,6 +614,14 @@ config CRYPTO_LZO
+@@ -666,6 +666,14 @@ config CRYPTO_LZO
help
This is the LZO algorithm.
endif # if CRYPTO
diff --git a/crypto/Makefile b/crypto/Makefile
-index ca02441..819b2cc 100644
+index d4f3ed8..fe05a9e 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
-@@ -62,6 +62,7 @@ obj-$(CONFIG_CRYPTO_SALSA20) += salsa20_generic.o
+@@ -67,6 +67,7 @@ obj-$(CONFIG_CRYPTO_SALSA20) += salsa20_generic.o
obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o
obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o
obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("LZF Compression Algorithm");
+MODULE_AUTHOR("Marc Alexander Lehmann & Nigel Cunningham");
+diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
+index 273a944..37c1e9f 100644
+--- a/drivers/base/power/main.c
++++ b/drivers/base/power/main.c
+@@ -54,6 +54,7 @@ void device_pm_lock(void)
+ {
+ mutex_lock(&dpm_list_mtx);
+ }
++EXPORT_SYMBOL(device_pm_lock);
+
+ /**
+ * device_pm_unlock - unlock the list of active devices used by the PM core
+@@ -62,6 +63,7 @@ void device_pm_unlock(void)
+ {
+ mutex_unlock(&dpm_list_mtx);
+ }
++EXPORT_SYMBOL(device_pm_unlock);
+
+ /**
+ * device_pm_add - add a device to the list of active devices
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
-index d6365a9..03e1eff 100644
+index d524dc2..681972e 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
-@@ -39,7 +39,6 @@
+@@ -40,7 +40,6 @@
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/sysdev.h>
#include <linux/suspend.h>
#include <linux/cpu.h>
diff --git a/drivers/md/md.c b/drivers/md/md.c
-index 2580ac1..4c20dab 100644
+index deeac4b..cbf1e49 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
-@@ -5730,6 +5730,8 @@ void md_do_sync(mddev_t *mddev)
+@@ -5899,6 +5899,8 @@ void md_do_sync(mddev_t *mddev)
last_mark = next;
}
if (kthread_should_stop())
goto interrupted;
diff --git a/fs/buffer.c b/fs/buffer.c
-index 0f51c0f..cebc137 100644
+index ac78d4c..3a927e2 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -247,6 +247,91 @@ void thaw_bdev(struct block_device *bdev, struct super_block *sb)
if (nbytes < sizeof(struct fuse_out_header))
return -EINVAL;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
-index 2060bf0..9e23548 100644
+index fd03330..347e054 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -7,12 +7,14 @@
#if BITS_PER_LONG >= 64
static inline void fuse_dentry_settime(struct dentry *entry, u64 time)
-@@ -176,6 +178,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
+@@ -174,6 +176,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
return 0;
fc = get_fuse_conn(inode);
req = fuse_get_req(fc);
if (IS_ERR(req))
return 0;
-@@ -271,6 +276,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
+@@ -273,6 +278,8 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name,
if (IS_ERR(req))
- return ERR_CAST(req);
+ goto out;
-+ FUSE_MIGHT_FREEZE(dir->i_sb, "fuse_lookup");
++ FUSE_MIGHT_FREEZE(sb, "fuse_lookup");
+
forget_req = fuse_get_req(fc);
+ err = PTR_ERR(forget_req);
if (IS_ERR(forget_req)) {
- fuse_put_request(fc, req);
-@@ -361,6 +368,8 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
+@@ -402,6 +409,8 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
if (IS_ERR(forget_req))
return PTR_ERR(forget_req);
req = fuse_get_req(fc);
err = PTR_ERR(req);
if (IS_ERR(req))
-@@ -447,6 +456,8 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
+@@ -488,6 +497,8 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
int err;
struct fuse_req *forget_req;
forget_req = fuse_get_req(fc);
if (IS_ERR(forget_req)) {
fuse_put_request(fc, req);
-@@ -544,7 +555,11 @@ static int fuse_mkdir(struct inode *dir, struct dentry *entry, int mode)
+@@ -585,7 +596,11 @@ static int fuse_mkdir(struct inode *dir, struct dentry *entry, int mode)
{
struct fuse_mkdir_in inarg;
struct fuse_conn *fc = get_fuse_conn(dir);
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -564,7 +579,11 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry,
+@@ -605,7 +620,11 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry,
{
struct fuse_conn *fc = get_fuse_conn(dir);
unsigned len = strlen(link) + 1;
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -581,7 +600,11 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
+@@ -622,7 +641,11 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
{
int err;
struct fuse_conn *fc = get_fuse_conn(dir);
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -612,7 +635,11 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
+@@ -653,7 +676,11 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
{
int err;
struct fuse_conn *fc = get_fuse_conn(dir);
return PTR_ERR(req);
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
-index 8092f0d..813c656 100644
+index 2bada6b..2e4af49 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -7,11 +7,13 @@
req = fuse_get_req(fc);
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -1345,6 +1355,8 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
+@@ -1350,6 +1360,8 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
if (fl->fl_flags & FL_CLOSE)
return 0;
req = fuse_get_req(fc);
if (IS_ERR(req))
return PTR_ERR(req);
-@@ -1409,6 +1421,8 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
+@@ -1416,6 +1428,8 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
if (!inode->i_sb->s_bdev || fc->no_bmap)
return 0;
+ } \
+} while (0)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
-index 3141690..c826200 100644
+index d2249f1..04ae6cb 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
-@@ -739,7 +739,7 @@ static int fuse_get_sb(struct file_system_type *fs_type,
+@@ -914,7 +914,7 @@ static int fuse_get_sb(struct file_system_type *fs_type,
static struct file_system_type fuse_fs_type = {
.owner = THIS_MODULE,
.name = "fuse",
.get_sb = fuse_get_sb,
.kill_sb = kill_anon_super,
};
-@@ -758,7 +758,7 @@ static struct file_system_type fuseblk_fs_type = {
+@@ -933,7 +933,7 @@ static struct file_system_type fuseblk_fs_type = {
.name = "fuseblk",
.get_sb = fuse_get_sb_blk,
.kill_sb = kill_block_super,
}
+EXPORT_SYMBOL(sys_ioctl);
diff --git a/fs/namei.c b/fs/namei.c
-index 01e67dd..aedaedf 100644
+index 4ea63ed..65be6a6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
-@@ -2314,6 +2314,8 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
+@@ -2223,6 +2223,8 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
if (!dir->i_op || !dir->i_op->unlink)
return -EPERM;
DQUOT_INIT(dir);
mutex_lock(&dentry->d_inode->i_mutex);
-diff --git a/include/asm-powerpc/suspend.h b/include/asm-powerpc/suspend.h
-index cbf2c94..e0756c2 100644
---- a/include/asm-powerpc/suspend.h
-+++ b/include/asm-powerpc/suspend.h
-@@ -6,4 +6,7 @@ static inline int arch_prepare_suspend(void) { return 0; }
- void save_processor_state(void);
- void restore_processor_state(void);
-
-+#define toi_faulted (0)
-+#define clear_toi_fault() do { } while (0)
-+
- #endif /* __ASM_POWERPC_SUSPEND_H */
-diff --git a/include/asm-ppc/suspend.h b/include/asm-ppc/suspend.h
-index 3df9f32..1e2e73d 100644
---- a/include/asm-ppc/suspend.h
-+++ b/include/asm-ppc/suspend.h
-@@ -10,3 +10,6 @@ static inline void save_processor_state(void)
- static inline void restore_processor_state(void)
- {
- }
-+
-+#define toi_faulted (0)
-+#define clear_toi_fault() do { } while (0)
-diff --git a/include/asm-x86/suspend_32.h b/include/asm-x86/suspend_32.h
-index 24e1c08..441efd6 100644
---- a/include/asm-x86/suspend_32.h
-+++ b/include/asm-x86/suspend_32.h
-@@ -8,6 +8,9 @@
-
- static inline int arch_prepare_suspend(void) { return 0; }
-
-+extern int toi_faulted;
-+#define clear_toi_fault() do { toi_faulted = 0; } while (0)
-+
- /* image of the saved processor state */
- struct saved_context {
- u16 es, fs, gs, ss;
-diff --git a/include/asm-x86/suspend_64.h b/include/asm-x86/suspend_64.h
-index dc3262b..5ff82a1 100644
---- a/include/asm-x86/suspend_64.h
-+++ b/include/asm-x86/suspend_64.h
-@@ -14,6 +14,9 @@ static inline int arch_prepare_suspend(void)
- return 0;
- }
-
-+#define toi_faulted (0)
-+#define clear_toi_fault() do { } while (0)
-+
- /*
- * Image of the saved processor state, used by the low level ACPI suspend to
- * RAM code and by the low level hibernation code.
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
-index 71d70d1..b5de633 100644
+index b68ec09..6eebd34 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
-@@ -207,6 +207,7 @@ unifdef-y += filter.h
+@@ -208,6 +208,7 @@ unifdef-y += filter.h
unifdef-y += flat.h
unifdef-y += futex.h
unifdef-y += fs.h
unifdef-y += generic_serial.h
unifdef-y += hayesesp.h
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
-index 82aa36c..ee09d61 100644
+index eadaab4..7eb6655 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
-@@ -172,6 +172,11 @@ wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
+@@ -171,6 +171,11 @@ wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
int fsync_bdev(struct block_device *);
struct super_block *freeze_bdev(struct block_device *);
void thaw_bdev(struct block_device *, struct super_block *);
+#endif
+#endif
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
-index 0893499..01e9dc6 100644
+index deddeed..4d92953 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -127,6 +127,19 @@ static inline void set_freezable(void)
+extern void thaw_kernel_threads(void);
+
/*
- * Freezer-friendly wrappers around wait_event_interruptible() and
- * wait_event_interruptible_timeout(), originally defined in <linux/wait.h>
-@@ -169,6 +182,8 @@ static inline int freeze_processes(void) { BUG(); return 0; }
+ * Tell the freezer that the current task should be frozen by it and that it
+ * should send a fake signal to the task to freeze it.
+@@ -178,6 +191,8 @@ static inline int freeze_processes(void) { BUG(); return 0; }
static inline void thaw_processes(void) {}
static inline int try_to_freeze(void) { return 0; }
static inline void freezer_do_not_count(void) {}
static inline void freezer_count(void) {}
diff --git a/include/linux/fs.h b/include/linux/fs.h
-index d8e2762..7db243f 100644
+index 580b513..e7a3169 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -8,6 +8,7 @@
/*
* It's silly to have NR_OPEN bigger than NR_FILE, but you can change
-@@ -94,6 +95,7 @@ extern int dir_notify_enable;
+@@ -96,6 +97,7 @@ extern int dir_notify_enable;
#define FS_REQUIRES_DEV 1
#define FS_BINARY_MOUNTDATA 2
#define FS_HAS_SUBTYPE 4
#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move()
* during rename() internally.
-@@ -126,6 +128,7 @@ extern int dir_notify_enable;
+@@ -128,6 +130,7 @@ extern int dir_notify_enable;
#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
#define MS_I_VERSION (1<<23) /* Update inode I_version field */
#define MS_ACTIVE (1<<30)
#define MS_NOUSER (1<<31)
-@@ -1105,8 +1108,11 @@ enum {
+@@ -1141,8 +1144,11 @@ enum {
SB_FREEZE_TRANS = 2,
};
#define get_fs_excl() atomic_inc(¤t->fs_excl)
#define put_fs_excl() atomic_dec(¤t->fs_excl)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
-index 2e70006..a43b516 100644
+index 2651f80..c50279d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
-@@ -157,6 +157,8 @@ extern int vsprintf(char *buf, const char *, va_list)
+@@ -165,6 +165,8 @@ extern int vsprintf(char *buf, const char *, va_list)
__attribute__ ((format (printf, 2, 0)));
extern int snprintf(char * buf, size_t size, const char * fmt, ...)
__attribute__ ((format (printf, 3, 4)));
__attribute__ ((format (printf, 3, 0)));
extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
diff --git a/include/linux/mm.h b/include/linux/mm.h
-index 586a943..bd34f82 100644
+index 72a15dc..01a7657 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
-@@ -1244,6 +1244,7 @@ int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
+@@ -1264,6 +1264,7 @@ int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
void __user *, size_t *, loff_t *);
unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
unsigned long lru_pages);
#ifndef CONFIG_MMU
#define randomize_va_space 0
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
-index bec1062..e7f772f 100644
+index 9ff1b54..100dc2e 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -24,6 +24,8 @@
#define MAX_LINKS 32
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
-index a697742..505cfa2 100644
+index 2ce8207..374e892 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
-@@ -266,4 +266,69 @@ static inline void register_nosave_region_late(unsigned long b, unsigned long e)
- }
- #endif
+@@ -280,4 +280,69 @@ static inline void register_nosave_region_late(unsigned long b, unsigned long e)
+
+ extern struct mutex pm_mutex;
+enum {
+ TOI_CAN_HIBERNATE,
+
#endif /* _LINUX_SUSPEND_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
-index 0b33776..5d6433b 100644
+index de40f16..44050a6 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -164,6 +164,7 @@ extern unsigned long totalram_pages;
extern int vm_swappiness;
extern int remove_mapping(struct address_space *mapping, struct page *page);
extern long vm_total_pages;
-@@ -356,5 +359,10 @@ static inline swp_entry_t get_swap_page(void)
+@@ -353,5 +356,10 @@ static inline swp_entry_t get_swap_page(void)
#define disable_swap_token() do { } while(0)
#endif /* CONFIG_SWAP */
#endif /* __KERNEL__*/
#endif /* _LINUX_SWAP_H */
diff --git a/init/do_mounts.c b/init/do_mounts.c
-index 660c1e5..8ea449f 100644
+index 3715feb..0463ea1 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
-@@ -398,6 +398,8 @@ void __init prepare_namespace(void)
+@@ -400,6 +400,8 @@ void __init prepare_namespace(void)
if (is_floppy && rd_doload && rd_load_disk(0))
ROOT_DEV = Root_RAM0;
sys_fchdir(old_fd);
sys_mount("/", ".", NULL, MS_MOVE, NULL);
diff --git a/init/main.c b/init/main.c
-index f7fb200..6746e95 100644
+index f6f7042..038a94f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -57,6 +57,7 @@
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/idr.h>
-@@ -602,6 +603,7 @@ asmlinkage void __init start_kernel(void)
+@@ -607,6 +608,7 @@ asmlinkage void __init start_kernel(void)
softirq_init();
timekeeping_init();
time_init();
sched_clock_init();
profile_init();
if (!irqs_disabled())
-@@ -641,6 +643,7 @@ asmlinkage void __init start_kernel(void)
+@@ -648,6 +650,7 @@ asmlinkage void __init start_kernel(void)
enable_debug_pagealloc();
cpu_hotplug_init();
kmem_cache_init();
idr_init_cache();
setup_per_cpu_pageset();
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
-index b45da40..a74041c 100644
+index dcd165f..7c80422 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -34,6 +34,18 @@ config PM_VERBOSE
config CAN_PM_TRACE
def_bool y
depends on PM_DEBUG && PM_SLEEP && EXPERIMENTAL
-@@ -168,6 +180,272 @@ config PM_STD_PARTITION
+@@ -179,6 +191,272 @@ config PM_STD_PARTITION
suspended image to. It will simply pick the first available swap
device.
obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
-index 14a656c..141606e 100644
+index bbd85c6..2e444e6 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
-@@ -24,9 +24,11 @@
+@@ -25,9 +25,11 @@
#include "power.h"
dev_t swsusp_resume_device;
sector_t swsusp_resume_block;
-@@ -104,7 +106,7 @@ static int hibernation_test(int level) { return 0; }
+@@ -105,7 +107,7 @@ static int hibernation_test(int level) { return 0; }
* hibernation
*/
{
return (platform_mode && hibernation_ops) ?
hibernation_ops->begin() : 0;
-@@ -115,7 +117,7 @@ static int platform_begin(int platform_mode)
+@@ -116,7 +118,7 @@ static int platform_begin(int platform_mode)
* working state
*/
{
if (platform_mode && hibernation_ops)
hibernation_ops->end();
-@@ -126,7 +128,7 @@ static void platform_end(int platform_mode)
+@@ -127,7 +129,7 @@ static void platform_end(int platform_mode)
* platform driver if so configured and return an error code if it fails
*/
{
return (platform_mode && hibernation_ops) ?
hibernation_ops->pre_snapshot() : 0;
-@@ -137,7 +139,7 @@ static int platform_pre_snapshot(int platform_mode)
+@@ -138,7 +140,7 @@ static int platform_pre_snapshot(int platform_mode)
* of operation using the platform driver (called with interrupts disabled)
*/
{
if (platform_mode && hibernation_ops)
hibernation_ops->leave();
-@@ -148,7 +150,7 @@ static void platform_leave(int platform_mode)
+@@ -149,7 +151,7 @@ static void platform_leave(int platform_mode)
* using the platform driver (must be called after platform_prepare())
*/
{
if (platform_mode && hibernation_ops)
hibernation_ops->finish();
-@@ -160,7 +162,7 @@ static void platform_finish(int platform_mode)
+@@ -161,7 +163,7 @@ static void platform_finish(int platform_mode)
* called, platform_restore_cleanup() must be called.
*/
{
return (platform_mode && hibernation_ops) ?
hibernation_ops->pre_restore() : 0;
-@@ -173,7 +175,7 @@ static int platform_pre_restore(int platform_mode)
+@@ -174,7 +176,7 @@ static int platform_pre_restore(int platform_mode)
* regardless of the result of platform_pre_restore().
*/
{
if (platform_mode && hibernation_ops)
hibernation_ops->restore_cleanup();
-@@ -477,6 +479,11 @@ int hibernate(void)
+@@ -508,6 +510,11 @@ int hibernate(void)
{
int error;
mutex_lock(&pm_mutex);
/* The snapshot device should not be opened while we're running */
if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
-@@ -549,10 +556,21 @@ int hibernate(void)
+@@ -580,10 +587,21 @@ int hibernate(void)
*
*/
/*
* name_to_dev_t() below takes a sysfs buffer mutex when sysfs
-@@ -565,6 +583,7 @@ static int software_resume(void)
+@@ -596,6 +614,7 @@ static int software_resume(void)
* here to avoid lockdep complaining.
*/
mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING);
if (!swsusp_resume_device) {
if (!strlen(resume_file)) {
mutex_unlock(&pm_mutex);
-@@ -636,9 +655,6 @@ static int software_resume(void)
+@@ -667,9 +686,6 @@ static int software_resume(void)
return error;
}
static const char * const hibernation_modes[] = {
[HIBERNATION_PLATFORM] = "platform",
[HIBERNATION_SHUTDOWN] = "shutdown",
-@@ -851,6 +867,7 @@ static int __init resume_offset_setup(char *str)
+@@ -882,6 +898,7 @@ static int __init resume_offset_setup(char *str)
static int __init noresume_setup(char *str)
{
noresume = 1;
}
diff --git a/kernel/power/power.h b/kernel/power/power.h
-index 700f44e..fdc558a 100644
+index acc0c10..6a4a5b4 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -1,7 +1,16 @@
/*
* Keep some memory free so that I/O operations can succeed without paging
* [Might this be more than 4 MB?]
-@@ -65,6 +78,8 @@ static struct kobj_attribute _name##_attr = { \
+@@ -63,6 +76,8 @@ static struct kobj_attribute _name##_attr = { \
.store = _name##_store, \
}
/* Preferred image size in bytes (default 500 MB) */
extern unsigned long image_size;
extern int in_suspend;
-@@ -225,3 +240,26 @@ static inline void suspend_thaw_processes(void)
+@@ -223,3 +238,26 @@ static inline void suspend_thaw_processes(void)
{
}
#endif
+
+#endif
diff --git a/kernel/power/process.c b/kernel/power/process.c
-index f1d0b34..b835412 100644
+index 278946a..ba2eb75 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -13,6 +13,10 @@
/*
* Timeout for stopping processes
-@@ -74,6 +78,7 @@ void refrigerator(void)
- pr_debug("%s left refrigerator\n", current->comm);
- __set_current_state(save);
- }
-+EXPORT_SYMBOL(refrigerator);
-
- static void fake_signal_wake_up(struct task_struct *p)
- {
-@@ -214,7 +219,8 @@ static int try_to_freeze_tasks(int freeze_user_space)
+@@ -201,7 +205,8 @@ static int try_to_freeze_tasks(bool sig_only)
do_each_thread(g, p) {
task_lock(p);
if (freezing(p) && !freezer_should_skip(p))
cancel_freezing(p);
task_unlock(p);
} while_each_thread(g, p);
-@@ -234,17 +240,25 @@ int freeze_processes(void)
+@@ -221,17 +226,25 @@ int freeze_processes(void)
{
int error;
+ freeze_filesystems(FS_FREEZER_FUSE);
+ freezer_state = FREEZER_FILESYSTEMS_FROZEN;
+ printk(KERN_INFO "Freezing user space processes ... ");
- error = try_to_freeze_tasks(FREEZER_USER_SPACE);
+ error = try_to_freeze_tasks(true);
if (error)
goto Exit;
- printk("done.\n");
+ freeze_filesystems(FS_FREEZER_NORMAL);
+ freezer_state = FREEZER_USERSPACE_FROZEN;
+ printk(KERN_INFO "Freezing remaining freezable tasks ... ");
- error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
+ error = try_to_freeze_tasks(false);
if (error)
goto Exit;
printk("done.");
Exit:
BUG_ON(in_atomic());
printk("\n");
-@@ -270,11 +284,33 @@ static void thaw_tasks(int thaw_user_space)
+@@ -257,11 +270,35 @@ static void thaw_tasks(bool nosig_only)
void thaw_processes(void)
{
- printk("Restarting tasks ... ");
-- thaw_tasks(FREEZER_KERNEL_THREADS);
+- thaw_tasks(true);
+ int old_state = freezer_state;
+
+ if (old_state == FREEZER_OFF)
+ printk(KERN_INFO "Restarting tasks ... ");
+
+ if (old_state == FREEZER_FULLY_ON)
-+ thaw_tasks(FREEZER_KERNEL_THREADS);
- thaw_tasks(FREEZER_USER_SPACE);
++ thaw_tasks(true);
+ thaw_tasks(false);
schedule();
printk("done.\n");
}
--EXPORT_SYMBOL(refrigerator);
+ EXPORT_SYMBOL(refrigerator);
++
+void thaw_kernel_threads(void)
+{
+ freezer_state = FREEZER_USERSPACE_FROZEN;
+ printk(KERN_INFO "Restarting normal filesystems.\n");
+ thaw_filesystems(FS_FREEZER_NORMAL);
-+ thaw_tasks(FREEZER_KERNEL_THREADS);
++ thaw_tasks(true);
+}
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
-index 5f91a07..5a08d0b 100644
+index 5d2ab83..bdb3071 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -33,6 +33,7 @@
return (unsigned long)get_image_page(gfp_mask, PG_SAFE);
}
-@@ -607,18 +619,8 @@ static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm)
- return bb->start_pfn + chunk * BM_BITS_PER_CHUNK + bit;
+@@ -561,18 +573,8 @@ static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm)
+ return bb->start_pfn + bit;
}
-/**
/**
* register_nosave_region - register a range of page frames the contents
-@@ -855,7 +857,7 @@ static unsigned int count_free_highmem_pages(void)
+@@ -809,7 +811,7 @@ static unsigned int count_free_highmem_pages(void)
* and it isn't a part of a free chunk of pages.
*/
{
struct page *page;
-@@ -897,8 +899,6 @@ unsigned int count_highmem_pages(void)
+@@ -851,8 +853,6 @@ unsigned int count_highmem_pages(void)
}
return n;
}
#endif /* CONFIG_HIGHMEM */
/**
-@@ -910,7 +910,7 @@ static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; }
+@@ -864,7 +864,7 @@ static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; }
* a free chunk of pages.
*/
{
struct page *page;
-@@ -1244,6 +1244,11 @@ asmlinkage int swsusp_save(void)
+@@ -1198,6 +1198,11 @@ asmlinkage int swsusp_save(void)
{
unsigned int nr_pages, nr_highmem;
printk(KERN_INFO "PM: Creating hibernation image: \n");
drain_local_pages(NULL);
-@@ -1284,14 +1289,14 @@ asmlinkage int swsusp_save(void)
+@@ -1238,14 +1243,14 @@ asmlinkage int swsusp_save(void)
}
#ifndef CONFIG_ARCH_HIBERNATION_HEADER
{
if (info->version_code != LINUX_VERSION_CODE)
return "kernel version";
-@@ -1305,6 +1310,7 @@ static char *check_image_kernel(struct swsusp_info *info)
+@@ -1259,6 +1264,7 @@ static char *check_image_kernel(struct swsusp_info *info)
return "machine";
return NULL;
}
#endif /* CONFIG_ARCH_HIBERNATION_HEADER */
unsigned long snapshot_get_image_size(void)
-@@ -1312,7 +1318,7 @@ unsigned long snapshot_get_image_size(void)
+@@ -1266,7 +1272,7 @@ unsigned long snapshot_get_image_size(void)
return nr_copy_pages + nr_meta_pages + 1;
}
{
memset(info, 0, sizeof(struct swsusp_info));
info->num_physpages = num_physpages;
-@@ -1320,7 +1326,7 @@ static int init_header(struct swsusp_info *info)
+@@ -1274,7 +1280,7 @@ static int init_header(struct swsusp_info *info)
info->pages = snapshot_get_image_size();
info->size = info->pages;
info->size <<= PAGE_SHIFT;
}
/**
-@@ -1376,7 +1382,7 @@ int snapshot_read_next(struct snapshot_handle *handle, size_t count)
+@@ -1330,7 +1336,7 @@ int snapshot_read_next(struct snapshot_handle *handle, size_t count)
if (!handle->offset) {
int error;
if (error)
return error;
handle->buffer = buffer;
-@@ -1473,7 +1479,7 @@ static int check_header(struct swsusp_info *info)
+@@ -1427,7 +1433,7 @@ static int check_header(struct swsusp_info *info)
{
char *reason;
+#endif
diff --git a/kernel/power/tuxonice_atomic_copy.c b/kernel/power/tuxonice_atomic_copy.c
new file mode 100644
-index 0000000..6a15805
+index 0000000..e2f0c2a
--- /dev/null
+++ b/kernel/power/tuxonice_atomic_copy.c
-@@ -0,0 +1,379 @@
+@@ -0,0 +1,384 @@
+/*
+ * kernel/power/tuxonice_atomic_copy.c
+ *
+ for (i = 0; i < pagedir1.size; i++) {
+ unsigned long *origvirt, *copyvirt;
+ struct page *origpage, *copypage;
-+ int loop = (PAGE_SIZE / sizeof(unsigned long)) - 1;
++ int loop = (PAGE_SIZE / sizeof(unsigned long)) - 1,
++ was_present;
+
+ origpage = pfn_to_page(source_index);
+ copypage = pfn_to_page(dest_index);
+ kmap_atomic(copypage, KM_USER1) :
+ page_address(copypage);
+
++ was_present = kernel_page_present(origpage);
++ if (!was_present)
++ kernel_map_pages(origpage, 1, 1);
++
+ while (loop >= 0) {
+ *(copyvirt + loop) = *(origvirt + loop);
+ loop--;
+ }
+
++ if (!was_present)
++ kernel_map_pages(origpage, 1, 0);
++
+ if (PageHighMem(origpage))
+ kunmap_atomic(origvirt, KM_USER0);
-+ else if (toi_faulted) {
-+ printk(KERN_INFO "%p (%lu) being unmapped after "
-+ "faulting during atomic copy.\n", origpage,
-+ source_index);
-+ kernel_map_pages(origpage, 1, 0);
-+ clear_toi_fault();
-+ }
+
+ if (PageHighMem(copypage))
+ kunmap_atomic(copyvirt, KM_USER1);
+ if (add_boot_kernel_data_pbe())
+ goto Failed;
+
-+ if (toi_go_atomic(PMSG_PRETHAW, 0))
++ if (toi_go_atomic(PMSG_QUIESCE, 0))
+ goto Failed;
+
+ /* We'll ignore saved state, but this gets preempt count (etc) right */
+
+ if (suspend_time && toi_platform_begin()) {
+ set_abort_result(TOI_PLATFORM_PREP_FAILED);
-+ toi_end_atomic(ATOMIC_STEP_PLATFORM_END, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_PLATFORM_END, suspend_time, 0);
+ return 1;
+ }
+
+
+ if (device_suspend(state)) {
+ set_abort_result(TOI_DEVICE_REFUSED);
-+ toi_end_atomic(ATOMIC_STEP_RESUME_CONSOLE, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_RESUME_CONSOLE, suspend_time, 1);
+ return 1;
+ }
+
+ if (suspend_time && toi_platform_pre_snapshot()) {
+ set_abort_result(TOI_PRE_SNAPSHOT_FAILED);
-+ toi_end_atomic(ATOMIC_STEP_PLATFORM_FINISH, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_PLATFORM_FINISH, suspend_time, 0);
+ return 1;
+ }
+
+ if (!suspend_time && toi_platform_pre_restore()) {
+ set_abort_result(TOI_PRE_RESTORE_FAILED);
-+ toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time, 0);
+ return 1;
+ }
+
+ if (disable_nonboot_cpus()) {
+ set_abort_result(TOI_CPU_HOTPLUG_FAILED);
+ toi_end_atomic(ATOMIC_STEP_CPU_HOTPLUG,
-+ suspend_time);
++ suspend_time, 0);
+ return 1;
+ }
+ }
+
+ if (suspend_time && arch_prepare_suspend()) {
+ set_abort_result(TOI_ARCH_PREPARE_FAILED);
-+ toi_end_atomic(ATOMIC_STEP_CPU_HOTPLUG, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_CPU_HOTPLUG, suspend_time, 0);
+ return 1;
+ }
+
++ device_pm_lock();
+ local_irq_disable();
+
+ /* At this point, device_suspend() has been called, but *not*
+
+ if (device_power_down(state)) {
+ set_abort_result(TOI_DEVICE_REFUSED);
-+ toi_end_atomic(ATOMIC_STEP_IRQS, suspend_time);
++ toi_end_atomic(ATOMIC_STEP_IRQS, suspend_time, 0);
+ return 1;
+ }
+
+ return 0;
+}
+
-+void toi_end_atomic(int stage, int suspend_time)
++void toi_end_atomic(int stage, int suspend_time, int error)
+{
+ switch (stage) {
+ case ATOMIC_ALL_STEPS:
+ if (!suspend_time)
+ toi_platform_leave();
-+ device_power_up();
++ device_power_up(error ? PMSG_RECOVER :
++ (suspend_time ? PMSG_THAW : PMSG_RESTORE));
+ case ATOMIC_STEP_IRQS:
+ local_irq_enable();
++ device_pm_unlock();
+ case ATOMIC_STEP_CPU_HOTPLUG:
+ if (test_action_state(TOI_LATE_CPU_HOTPLUG))
+ enable_nonboot_cpus();
+ case ATOMIC_STEP_PLATFORM_FINISH:
+ toi_platform_finish();
+ case ATOMIC_STEP_DEVICE_RESUME:
-+ device_resume();
++ device_resume(error ? PMSG_RECOVER :
++ (suspend_time ? PMSG_THAW : PMSG_RESTORE));
+ case ATOMIC_STEP_RESUME_CONSOLE:
+ resume_console();
+ case ATOMIC_STEP_PLATFORM_END:
+}
diff --git a/kernel/power/tuxonice_atomic_copy.h b/kernel/power/tuxonice_atomic_copy.h
new file mode 100644
-index 0000000..a57e254
+index 0000000..7ec08a8
--- /dev/null
+++ b/kernel/power/tuxonice_atomic_copy.h
@@ -0,0 +1,22 @@
+};
+
+int toi_go_atomic(pm_message_t state, int toi_time);
-+void toi_end_atomic(int stage, int toi_time);
++void toi_end_atomic(int stage, int toi_time, int error);
diff --git a/kernel/power/tuxonice_block_io.c b/kernel/power/tuxonice_block_io.c
new file mode 100644
index 0000000..b018914
+#endif
diff --git a/kernel/power/tuxonice_highlevel.c b/kernel/power/tuxonice_highlevel.c
new file mode 100644
-index 0000000..bbaeac2
+index 0000000..f233f24
--- /dev/null
+++ b/kernel/power/tuxonice_highlevel.c
@@ -0,0 +1,1328 @@
+ did_copy = 1;
+
+ /* We return here at resume time too! */
-+ toi_end_atomic(ATOMIC_ALL_STEPS, toi_in_hibernate);
++ toi_end_atomic(ATOMIC_ALL_STEPS, toi_in_hibernate, temp_result);
+
+Failed:
+ if (toi_activate_storage(1))
+#endif
diff --git a/kernel/power/tuxonice_netlink.c b/kernel/power/tuxonice_netlink.c
new file mode 100644
-index 0000000..cc328e5
+index 0000000..fd9e9c1
--- /dev/null
+++ b/kernel/power/tuxonice_netlink.c
@@ -0,0 +1,327 @@
+ netlink_unicast(uhd->nl, skb, uhd->pid, 0);
+
+ read_lock(&tasklist_lock);
-+ t = find_task_by_pid(uhd->pid);
++ t = find_task_by_pid_type_ns(PIDTYPE_PID, uhd->pid, &init_pid_ns);
+ if (!t) {
+ read_unlock(&tasklist_lock);
+ if (uhd->pid > -1)
+ struct task_struct *t;
+
+ read_lock(&tasklist_lock);
-+ t = find_task_by_pid(pid);
++ t = find_task_by_pid_type_ns(PIDTYPE_PID, pid, &init_pid_ns);
+ if (!t) {
+ read_unlock(&tasklist_lock);
+ printk(KERN_INFO "Strange. Can't find the userspace task %d.\n",
+ struct task_struct *t;
+
+ read_lock(&tasklist_lock);
-+ t = find_task_by_pid(uhd->pid);
++ t = find_task_by_pid_type_ns(PIDTYPE_PID, uhd->pid, &init_pid_ns);
+ if (t)
+ t->flags &= ~PF_NOFREEZE;
+ read_unlock(&tasklist_lock);
+extern int toi_pageflags_space_needed(void);
diff --git a/kernel/power/tuxonice_power_off.c b/kernel/power/tuxonice_power_off.c
new file mode 100644
-index 0000000..827d59d
+index 0000000..e35736f
--- /dev/null
+++ b/kernel/power/tuxonice_power_off.c
-@@ -0,0 +1,279 @@
+@@ -0,0 +1,284 @@
+/*
+ * kernel/power/tuxonice_power_off.c
+ *
+ break;
+ case 3:
+ error = pm_notifier_call_chain(PM_SUSPEND_PREPARE);
-+ if (!error)
++ if (!error) {
+ error = suspend_devices_and_enter(PM_SUSPEND_MEM);
++ if (!error)
++ did_suspend_to_both = 1;
++ }
+ pm_notifier_call_chain(PM_POST_SUSPEND);
-+ if (!error) {
-+ did_suspend_to_both = 1;
++
++ /* Success - we're now post-resume-from-ram */
++ if (did_suspend_to_both)
+ return;
-+ }
++
++ /* Failed to suspend to ram - do normal power off */
+ break;
+ case 4:
-+ /*
++ /*
+ * If succeeds, doesn't return. If fails, do a simple
+ * powerdown.
+ */
+#define toi_platform_restore_cleanup() platform_restore_cleanup(platform_test())
diff --git a/kernel/power/tuxonice_prepare_image.c b/kernel/power/tuxonice_prepare_image.c
new file mode 100644
-index 0000000..df7d739
+index 0000000..68f2fd3
--- /dev/null
+++ b/kernel/power/tuxonice_prepare_image.c
-@@ -0,0 +1,1054 @@
+@@ -0,0 +1,1056 @@
+/*
+ * kernel/power/tuxonice_prepare_image.c
+ *
+ else {
+ read_lock(&tasklist_lock);
+ for_each_process(p) {
-+ if (!p->mm || (p->flags & PF_BORROWED_MM))
++ if (!p->mm || (p->flags & PF_KTHREAD))
+ continue;
+
+ toi_mark_task_as_pageset(p, PAGESET2);
+
+ suspend_console();
+ device_suspend(PMSG_FREEZE);
++ device_pm_lock();
+ local_irq_disable(); /* irqs might have been re-enabled on us */
+ device_power_down(PMSG_FREEZE);
+
+ final = real_nr_free_pages(all_zones_mask);
+
-+ device_power_up();
++ device_power_up(PMSG_THAW);
+ local_irq_enable();
-+ device_resume();
++ device_pm_unlock();
++ device_resume(PMSG_THAW);
+ resume_console();
+
+ extra_pd1_pages_allowance = max(
+late_initcall(toi_user_ui_init);
+#endif
diff --git a/kernel/printk.c b/kernel/printk.c
-index e2129e8..fc9d16d 100644
+index b51b156..2f4e8da 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -32,6 +32,8 @@
#include <asm/uaccess.h>
-@@ -99,9 +101,12 @@ static DEFINE_SPINLOCK(logbuf_lock);
+@@ -101,9 +103,12 @@ static DEFINE_SPINLOCK(logbuf_lock);
* The indices into log_buf are not constrained to log_buf_len - they
* must be masked before subscripting
*/
/*
* Array of consoles built from command line options (console=)
-@@ -127,10 +132,11 @@ static int console_may_schedule;
+@@ -131,10 +136,11 @@ static int console_may_schedule;
#ifdef CONFIG_PRINTK
static int __init log_buf_len_setup(char *str)
{
-@@ -954,6 +960,7 @@ void suspend_console(void)
+@@ -937,6 +943,7 @@ void suspend_console(void)
acquire_console_sem();
console_suspended = 1;
}
void resume_console(void)
{
-@@ -962,6 +969,7 @@ void resume_console(void)
+@@ -945,6 +952,7 @@ void resume_console(void)
console_suspended = 0;
release_console_sem();
}
/**
* acquire_console_sem - lock the console system for exclusive use.
diff --git a/kernel/timer.c b/kernel/timer.c
-index ceacc66..77f9269 100644
+index 03bc7f1..d70831d 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -37,6 +37,8 @@
#include <asm/uaccess.h>
#include <asm/unistd.h>
-@@ -1010,6 +1012,59 @@ unsigned long avenrun[3];
+@@ -1002,6 +1004,59 @@ unsigned long avenrun[3];
EXPORT_SYMBOL(avenrun);
/*
* calc_load - given tick count, update the avenrun load estimates.
* This is called while holding a write_lock on xtime_lock.
-@@ -1503,6 +1558,7 @@ void __init init_timers(void)
+@@ -1495,6 +1550,7 @@ void __init init_timers(void)
BUG_ON(err == NOTIFY_BAD);
register_cpu_notifier(&timers_nb);
- open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL);
+ open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
+ register_pm_notifier_callback();
}
/**
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
-index 1dc2d1d..be5fc0b 100644
+index c399bc1..42e7072 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
-@@ -567,6 +567,29 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field
+@@ -558,6 +558,29 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field
return number(buf, end, (unsigned long) ptr, 16, field_width, precision, flags);
}
* vsnprintf - Format a string and place it in a buffer
* @buf: The buffer to place the result into
diff --git a/mm/Makefile b/mm/Makefile
-index 18c143b..bbd52ae 100644
+index da4ccf0..40d7f55 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -11,7 +11,7 @@ obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
maccess.o page_alloc.o page-writeback.o pdflush.o \
readahead.o swap.o truncate.o vmscan.o \
prio_tree.o util.o mmzone.o vmstat.o backing-dev.o \
-- page_isolation.o $(mmu-y)
-+ dyn_pageflags.o page_isolation.o $(mmu-y)
+- page_isolation.o mm_init.o $(mmu-y)
++ dyn_pageflags.o page_isolation.o mm_init.o $(mmu-y)
obj-$(CONFIG_PROC_PAGE_MONITOR) += pagewalk.o
obj-$(CONFIG_BOUNCE) += bounce.o
+
+__setup("dyn_pageflags_debug", dyn_pageflags_debug_setup);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
-index 833f854..5bd8e4c 100644
+index 89fee2d..bb289fd 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -213,6 +213,8 @@ static int __add_zone(struct zone *zone, unsigned long phys_start_pfn)
}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
-index f32fae3..2dd58f1 100644
+index 27b8681..6a707ed 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
-@@ -1731,6 +1731,26 @@ static unsigned int nr_free_zone_pages(int offset)
+@@ -1777,6 +1777,26 @@ static unsigned int nr_free_zone_pages(int offset)
return sum;
}
/*
* Amount of free RAM allocatable within ZONE_DMA and ZONE_NORMAL
*/
-@@ -1741,6 +1761,15 @@ unsigned int nr_free_buffer_pages(void)
+@@ -1787,6 +1807,15 @@ unsigned int nr_free_buffer_pages(void)
EXPORT_SYMBOL_GPL(nr_free_buffer_pages);
/*
*/
unsigned int nr_free_pagecache_pages(void)
diff --git a/mm/vmscan.c b/mm/vmscan.c
-index 967d30c..2ace4cb 100644
+index 1ff1a58..c02c6e6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
-@@ -776,6 +776,28 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
+@@ -811,6 +811,28 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
return nr_taken;
}
static unsigned long isolate_pages_global(unsigned long nr,
struct list_head *dst,
unsigned long *scanned, int order,
-@@ -826,7 +848,6 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
+@@ -861,7 +883,6 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
lru_add_drain();
spin_lock_irq(&zone->lru_lock);
do {
unsigned long nr_taken;
unsigned long nr_scan;
unsigned long nr_freed;
-@@ -888,21 +909,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
+@@ -923,21 +944,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
/*
* Put back any unfreeable pages.
*/
} while (nr_scanned < max_scan);
spin_unlock(&zone->lru_lock);
done:
-@@ -1626,6 +1633,72 @@ out:
+@@ -1665,6 +1672,72 @@ out:
return nr_reclaimed;
}
/*
* The background pageout daemon, started as a kernel thread
* from the init process.
-@@ -1710,6 +1783,9 @@ void wakeup_kswapd(struct zone *zone, int order)
+@@ -1749,6 +1822,9 @@ void wakeup_kswapd(struct zone *zone, int order)
if (!populated_zone(zone))
return;
pgdat = zone->zone_pgdat;
if (zone_watermark_ok(zone, order, zone->pages_low, 0, 0))
return;
-@@ -1723,6 +1799,109 @@ void wakeup_kswapd(struct zone *zone, int order)
+@@ -1762,6 +1838,109 @@ void wakeup_kswapd(struct zone *zone, int order)
}
#ifdef CONFIG_PM