Skip to contentSkip to conversation

PM: Do not sync from within the freezer during suspend to RAM

RFC PATCH In review Rafael J. Wysocki 5 participants 29 messages Jul 4, 2007 – Jul 7, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 PM: Do not sync from within the freezer during suspend to RAM

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer in not needed for suspend to RAM. Change freeze_processes() so that it doesn't execute sys_sync() and introduce the "syncing" version of it to be called from the hibernation code paths.

---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)
include/linux/freezer.h +12 -2
Index: linux-2.6.22-rc7/include/linux/freezer.h
===================================================================
@@ -62,7 +62,7 @@ static inline int thaw_process(struct ta
 }
 
 extern void refrigerator(void);
-extern int freeze_processes(void);
+extern int __freeze_processes(int sync_filesystems);
 extern void thaw_processes(void);
 
 static inline int try_to_freeze(void)
@@ -134,7 +134,7 @@ static inline void clear_freeze_flag(str
 static inline int thaw_process(struct task_struct *p) { return 1; }
 
 static inline void refrigerator(void) {}
-static inline int freeze_processes(void) { BUG(); return 0; }
+static inline int __freeze_processes(int s) { BUG(); return 0; }
 static inline void thaw_processes(void) {}
 
 static inline int try_to_freeze(void) { return 0; }
@@ -145,4 +145,14 @@ static inline int freezer_should_skip(st
 static inline void set_freezable(void) {}
 #endif
 
+static inline int freeze_processes(void)
+{
+	return __freeze_processes(0);
+}
+
+static inline int freeze_processes_with_sync(void)
+{
+	return __freeze_processes(1);
+}
+
 #endif	/* FREEZER_H_INCLUDED */
kernel/power/disk.c +1 -1
Index: linux-2.6.22-rc7/kernel/power/disk.c
===================================================================
@@ -281,7 +281,7 @@ static int prepare_processes(void)
 	int error = 0;
 
 	pm_prepare_console();
-	if (freeze_processes()) {
+	if (freeze_processes_with_sync()) {
 		error = -EBUSY;
 		unprepare_processes();
 	}
kernel/power/main.c +6 -0
Index: linux-2.6.22-rc7/kernel/power/main.c
===================================================================
@@ -20,6 +20,7 @@
 #include <linux/resume-trace.h>
 #include <linux/freezer.h>
 #include <linux/vmstat.h>
+#include <linux/syscalls.h>
 
 #include "power.h"
 
@@ -231,6 +232,11 @@ static int enter_state(suspend_state_t s
 
 	if (!valid_state(state))
 		return -ENODEV;
+
+	printk("Syncing filesystems ... ");
+	sys_sync();
+	printk("done.\n");
+
 	if (!mutex_trylock(&pm_mutex))
 		return -EBUSY;
 
kernel/power/process.c +5 -3
Index: linux-2.6.22-rc7/kernel/power/process.c
===================================================================
@@ -179,9 +179,9 @@ static int try_to_freeze_tasks(int freez
 }
 
 /**
- *	freeze_processes - tell processes to enter the refrigerator
+ *	__freeze_processes - tell processes to enter the refrigerator
  */
-int freeze_processes(void)
+int __freeze_processes(int sync_filesystems)
 {
 	int error;
 
@@ -190,7 +190,9 @@ int freeze_processes(void)
 	if (error)
 		return error;
 
-	sys_sync();
+	if (sync_filesystems)
+		sys_sync();
+
 	error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
 	if (error)
 		return error;
kernel/power/user.c +1 -1
Index: linux-2.6.22-rc7/kernel/power/user.c
===================================================================
@@ -153,7 +153,7 @@ static int snapshot_ioctl(struct inode *
 		mutex_lock(&pm_mutex);
 		error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
 		if (!error) {
-			error = freeze_processes();
+			error = freeze_processes_with_sync();
 			if (error)
 				thaw_processes();
 		}
#1 lore raw

Hi.

Quoted 3 lines · On Thursday 05 July 2007 00:58:58 Rafael J. Wysocki wrote:

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer in not needed for suspend

to

Quoted 4 lines

RAM. Change freeze_processes() so that it doesn't execute sys_sync() and introduce the "syncing" version of it to be called from the hibernation code paths.

Quoted 8 lines
---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)

Looks ok, except that I wonder if you want the following fragment. It looks to me (looking at rc6) like with this code, you'll currently call sys_sync twice when suspending to ram. Maybe I'm misreading it. Also, shouldn't it be done after taking the mutex?

Regards,

Nigel

Quoted 12 lines
kernel/power/main.c +5 -0
@@ -231,6 +232,11 @@ static int enter_state(suspend_state_t s
 
 	if (!valid_state(state))
 		return -ENODEV;
+
+	printk("Syncing filesystems ... ");
+	sys_sync();
+	printk("done.\n");
+
 	if (!mutex_trylock(&pm_mutex))
 		return -EBUSY;
 
Signature · 4 lines
Nigel, Michelle and Alisdair Cunningham
5 Mitchell Street
Cobden 3266
Victoria, Australia
#2 lore raw
In reply to Rafael J. Wysocki

Hi.

Quoted 3 lines · On Thursday 05 July 2007 00:58:58 Rafael J. Wysocki wrote:

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer in not needed for suspend

to

Quoted 4 lines

RAM. Change freeze_processes() so that it doesn't execute sys_sync() and introduce the "syncing" version of it to be called from the hibernation code paths.

Quoted 8 lines
---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)

Looks ok, except that I wonder if you want the following fragment. It looks to me (looking at rc6) like with this code, you'll currently call sys_sync twice when suspending to ram. Maybe I'm misreading it. Also, shouldn't it be done after taking the mutex?

Regards,

Nigel

Quoted 12 lines
kernel/power/main.c +5 -0
@@ -231,6 +232,11 @@ static int enter_state(suspend_state_t s
 
 	if (!valid_state(state))
 		return -ENODEV;
+
+	printk("Syncing filesystems ... ");
+	sys_sync();
+	printk("done.\n");
+
 	if (!mutex_trylock(&pm_mutex))
 		return -EBUSY;
 
Signature · 4 lines
Nigel, Michelle and Alisdair Cunningham
5 Mitchell Street
Cobden 3266
Victoria, Australia
#3 lore raw
Quoted 20 lines · Nigel Cunningham

Hi.

Quoted 3 lines · On Thursday 05 July 2007 00:58:58 Rafael J. Wysocki wrote:

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer in not needed for suspend

to

Quoted 4 lines

RAM. Change freeze_processes() so that it doesn't execute sys_sync() and introduce the "syncing" version of it to be called from the hibernation code paths.

Quoted 8 lines
---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)
Quoted 4 lines

Looks ok, except that I wonder if you want the following fragment. It looks to me (looking at rc6) like with this code, you'll currently call sys_sync twice when suspending to ram. Maybe I'm misreading it. Also, shouldn't it be done after taking the mutex?

sys_sync() should be okay to call, mutex or not.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw
In reply to Nigel Cunningham
Quoted 20 lines · Nigel Cunningham

Hi.

Quoted 3 lines · On Thursday 05 July 2007 00:58:58 Rafael J. Wysocki wrote:

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer in not needed for suspend

to

Quoted 4 lines

RAM. Change freeze_processes() so that it doesn't execute sys_sync() and introduce the "syncing" version of it to be called from the hibernation code paths.

Quoted 8 lines
---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)
Quoted 4 lines

Looks ok, except that I wonder if you want the following fragment. It looks to me (looking at rc6) like with this code, you'll currently call sys_sync twice when suspending to ram. Maybe I'm misreading it. Also, shouldn't it be done after taking the mutex?

sys_sync() should be okay to call, mutex or not.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#5 lore raw

Hi.

Quoted 7 lines · On Thursday 05 July 2007 08:49:42 Pavel Machek wrote:
Quoted 6 lines · Nigel Cunningham

Hi.

Quoted 3 lines · On Thursday 05 July 2007 00:58:58 Rafael J. Wysocki wrote:

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer in not needed for

suspend

Quoted 2 lines
Quoted 2 lines

to

Quoted 1 line

RAM. Change freeze_processes() so that it doesn't execute sys_sync()

and

Quoted 1 line
Quoted 1 line
Quoted 1 line

introduce the "syncing" version of it to be called from the hibernation

code

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

paths.

---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)
Quoted 1 line
Quoted 1 line

Looks ok, except that I wonder if you want the following fragment. It

looks to

Quoted 1 line
Quoted 1 line

me (looking at rc6) like with this code, you'll currently call sys_sync

twice

Quoted 1 line
Quoted 1 line

when suspending to ram. Maybe I'm misreading it. Also, shouldn't it be

done

Quoted 3 lines
Quoted 1 line

after taking the mutex?

sys_sync() should be okay to call, mutex or not.

Yeah. That wasn't my point, sorry. Calling sys_sync is pointless if you're going to fail to take the mutex. It makes more sense to know you've got it before you start doing things related to actually suspending.

Regards,

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#6 lore raw
In reply to Pavel Machek

Hi.

Quoted 7 lines · On Thursday 05 July 2007 08:49:42 Pavel Machek wrote:
Quoted 6 lines · Nigel Cunningham

Hi.

Quoted 3 lines · On Thursday 05 July 2007 00:58:58 Rafael J. Wysocki wrote:

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer in not needed for

suspend

Quoted 2 lines
Quoted 2 lines

to

Quoted 1 line

RAM. Change freeze_processes() so that it doesn't execute sys_sync()

and

Quoted 1 line
Quoted 1 line
Quoted 1 line

introduce the "syncing" version of it to be called from the hibernation

code

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

paths.

---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)
Quoted 1 line
Quoted 1 line

Looks ok, except that I wonder if you want the following fragment. It

looks to

Quoted 1 line
Quoted 1 line

me (looking at rc6) like with this code, you'll currently call sys_sync

twice

Quoted 1 line
Quoted 1 line

when suspending to ram. Maybe I'm misreading it. Also, shouldn't it be

done

Quoted 3 lines
Quoted 1 line

after taking the mutex?

sys_sync() should be okay to call, mutex or not.

Yeah. That wasn't my point, sorry. Calling sys_sync is pointless if you're going to fail to take the mutex. It makes more sense to know you've got it before you start doing things related to actually suspending.

Regards,

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#7 lore raw
Quoted 32 lines · Nigel Cunningham

Hi.

Quoted 7 lines · On Thursday 05 July 2007 08:49:42 Pavel Machek wrote:
Quoted 6 lines · Nigel Cunningham

Hi.

Quoted 3 lines · On Thursday 05 July 2007 00:58:58 Rafael J. Wysocki wrote:

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer in not needed for

suspend

Quoted 2 lines
Quoted 2 lines

to

Quoted 1 line

RAM. Change freeze_processes() so that it doesn't execute sys_sync()

and

Quoted 1 line
Quoted 1 line
Quoted 1 line

introduce the "syncing" version of it to be called from the hibernation

code

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

paths.

---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)
Quoted 1 line
Quoted 1 line

Looks ok, except that I wonder if you want the following fragment. It

looks to

Quoted 1 line
Quoted 1 line

me (looking at rc6) like with this code, you'll currently call sys_sync

twice

Quoted 1 line
Quoted 1 line

when suspending to ram. Maybe I'm misreading it. Also, shouldn't it be

Quoted 8 lines

done

Quoted 3 lines
Quoted 1 line

after taking the mutex?

sys_sync() should be okay to call, mutex or not.

Yeah. That wasn't my point, sorry. Calling sys_sync is pointless if you're going to fail to take the mutex. It makes more sense to know you've got it before you start doing things related to actually suspending.

Well, that's a valid point, I'll move it under the mutex.

And why do you think it will be called twice?

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#8 lore raw

Hi.

Quoted 8 lines · On Thursday 05 July 2007 21:28:49 Rafael J. Wysocki wrote:
Quoted 7 lines · Nigel Cunningham
Quoted 3 lines · On Thursday 05 July 2007 08:49:42 Pavel Machek wrote:
Quoted 2 lines · Nigel Cunningham
Quoted 1 line · On Thursday 05 July 2007 00:58:58 Rafael J. Wysocki wrote:

The syncing of filesystems from within the freezer in not needed for

suspend

Quoted 2 lines
Quoted 2 lines

to

Quoted 1 line

RAM. Change freeze_processes() so that it doesn't execute

sys_sync()

Quoted 2 lines
Quoted 2 lines

and

Quoted 1 line
Quoted 1 line
Quoted 1 line

introduce the "syncing" version of it to be called from the

hibernation

Quoted 12 lines
Quoted 12 lines

code

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

paths.

---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Looks ok, except that I wonder if you want the following fragment. It

looks to

Quoted 1 line
Quoted 1 line

me (looking at rc6) like with this code, you'll currently call

sys_sync

Quoted 5 lines
Quoted 5 lines

twice

Quoted 1 line
Quoted 1 line

when suspending to ram. Maybe I'm misreading it. Also, shouldn't it be

done

Quoted 2 lines
Quoted 1 line

after taking the mutex?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

sys_sync() should be okay to call, mutex or not.

Yeah. That wasn't my point, sorry. Calling sys_sync is pointless if you're going to fail to take the mutex. It makes more sense to know you've got it before you start doing things related to actually suspending.

Well, that's a valid point, I'll move it under the mutex.

Okee doke.

Quoted 1 line

And why do you think it will be called twice?

Hmm. Looking again now, I can't see why I thought that. Maybe I just hadn't had enough caffeine today at that stage :)

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#9 lore raw
In reply to Rafael J. Wysocki

Hi.

Quoted 8 lines · On Thursday 05 July 2007 21:28:49 Rafael J. Wysocki wrote:
Quoted 7 lines · Nigel Cunningham
Quoted 3 lines · On Thursday 05 July 2007 08:49:42 Pavel Machek wrote:
Quoted 2 lines · Nigel Cunningham
Quoted 1 line · On Thursday 05 July 2007 00:58:58 Rafael J. Wysocki wrote:

The syncing of filesystems from within the freezer in not needed for

suspend

Quoted 2 lines
Quoted 2 lines

to

Quoted 1 line

RAM. Change freeze_processes() so that it doesn't execute

sys_sync()

Quoted 2 lines
Quoted 2 lines

and

Quoted 1 line
Quoted 1 line
Quoted 1 line

introduce the "syncing" version of it to be called from the

hibernation

Quoted 12 lines
Quoted 12 lines

code

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

paths.

---
 include/linux/freezer.h |   14 ++++++++++++--
 kernel/power/disk.c     |    2 +-
 kernel/power/main.c     |    6 ++++++
 kernel/power/process.c  |    8 +++++---
 kernel/power/user.c     |    2 +-
 5 files changed, 25 insertions(+), 7 deletions(-)
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Looks ok, except that I wonder if you want the following fragment. It

looks to

Quoted 1 line
Quoted 1 line

me (looking at rc6) like with this code, you'll currently call

sys_sync

Quoted 5 lines
Quoted 5 lines

twice

Quoted 1 line
Quoted 1 line

when suspending to ram. Maybe I'm misreading it. Also, shouldn't it be

done

Quoted 2 lines
Quoted 1 line

after taking the mutex?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

sys_sync() should be okay to call, mutex or not.

Yeah. That wasn't my point, sorry. Calling sys_sync is pointless if you're going to fail to take the mutex. It makes more sense to know you've got it before you start doing things related to actually suspending.

Well, that's a valid point, I'll move it under the mutex.

Okee doke.

Quoted 1 line

And why do you think it will be called twice?

Hmm. Looking again now, I can't see why I thought that. Maybe I just hadn't had enough caffeine today at that stage :)

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#10 lore raw

RFC PATCH 1/1 PM: Do not sync filesystems from within the freezer

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer is generally not needed. Change freeze_processes() so that it doesn't execute sys_sync() and make the suspend and hibernation code path sync filesystems independently of the freezer.

---
 kernel/power/disk.c    |    4 ++++
 kernel/power/main.c    |    6 ++++++
 kernel/power/process.c |    1 -
 kernel/power/user.c    |    4 ++++
 4 files changed, 14 insertions(+), 1 deletion(-)
kernel/power/disk.c +4 -0
Index: linux-2.6.22-rc6-mm1/kernel/power/disk.c
===================================================================
@@ -297,6 +297,10 @@ int hibernate(void)
 	if (error)
 		goto Exit;
 
+	printk("Syncing filesystems ... ");
+	sys_sync();
+	printk("done.\n");
+
 	error = prepare_processes();
 	if (error)
 		goto Finish;
kernel/power/main.c +6 -0
Index: linux-2.6.22-rc6-mm1/kernel/power/main.c
===================================================================
@@ -20,6 +20,7 @@
 #include <linux/resume-trace.h>
 #include <linux/freezer.h>
 #include <linux/vmstat.h>
+#include <linux/syscalls.h>
 
 #include "power.h"
 
@@ -234,9 +235,14 @@ static int enter_state(suspend_state_t s
 
 	if (!valid_state(state))
 		return -ENODEV;
+
 	if (!mutex_trylock(&pm_mutex))
 		return -EBUSY;
 
+	printk("Syncing filesystems ... ");
+	sys_sync();
+	printk("done.\n");
+
 	pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
 	if ((error = suspend_prepare()))
 		goto Unlock;
kernel/power/process.c +0 -1
Index: linux-2.6.22-rc6-mm1/kernel/power/process.c
===================================================================
@@ -191,7 +191,6 @@ int freeze_processes(void)
 	if (error)
 		return error;
 
-	sys_sync();
 	error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
 	if (error)
 		return error;
kernel/power/user.c +4 -0
Index: linux-2.6.22-rc6-mm1/kernel/power/user.c
===================================================================
@@ -153,6 +153,10 @@ static int snapshot_ioctl(struct inode *
 		mutex_lock(&pm_mutex);
 		error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
 		if (!error) {
+			printk("Syncing filesystems ... ");
+			sys_sync();
+			printk("done.\n");
+
 			error = freeze_processes();
 			if (error)
 				thaw_processes();
#11 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

Hi!

Quoted 5 lines

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer is generally not needed. Change freeze_processes() so that it doesn't execute sys_sync() and make the suspend and hibernation code path sync filesystems independently of the freezer.

Yes, we can do that, but ... why?

Does it actually fix FUSE? Miklos claims sync is nop on FUSE...?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#12 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

In reply to Rafael J. Wysocki

Hi!

Quoted 5 lines

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer is generally not needed. Change freeze_processes() so that it doesn't execute sys_sync() and make the suspend and hibernation code path sync filesystems independently of the freezer.

Yes, we can do that, but ... why?

Does it actually fix FUSE? Miklos claims sync is nop on FUSE...?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#13 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

Quoted 9 lines · Pavel Machek

Hi!

Quoted 5 lines

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer is generally not needed. Change freeze_processes() so that it doesn't execute sys_sync() and make the suspend and hibernation code path sync filesystems independently of the freezer.

Yes, we can do that, but ... why?

I think that sync and the freezer are different things and shouldn't be mixed in such a way as they are now.

Quoted 1 line

Does it actually fix FUSE?

It should prevent the freezer from deadlocking.

Quoted 1 line

Miklos claims sync is nop on FUSE...?

In that case there shouldn't be any deadlock, but a freezer failure. :-)

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#28 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

In reply to Pavel Machek
Quoted 9 lines · Pavel Machek

Hi!

Quoted 5 lines

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer is generally not needed. Change freeze_processes() so that it doesn't execute sys_sync() and make the suspend and hibernation code path sync filesystems independently of the freezer.

Yes, we can do that, but ... why?

I think that sync and the freezer are different things and shouldn't be mixed in such a way as they are now.

Quoted 1 line

Does it actually fix FUSE?

It should prevent the freezer from deadlocking.

Quoted 1 line

Miklos claims sync is nop on FUSE...?

In that case there shouldn't be any deadlock, but a freezer failure. :-)

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#14 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

In reply to Rafael J. Wysocki

Hi.

Quoted 6 lines · On Friday 06 July 2007 17:02:53 Rafael J. Wysocki wrote:
Quoted 5 lines · Pavel Machek

Hi!

Quoted 3 lines

From: Rafael J. Wysocki <[email protected]>

The syncing of filesystems from within the freezer is generally not

needed.

Quoted 1 line
Quoted 1 line
Quoted 1 line

Change freeze_processes() so that it doesn't execute sys_sync() and make

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

suspend and hibernation code path sync filesystems independently of the

freezer.

Quoted 4 lines
Quoted 2 lines

Yes, we can do that, but ... why?

I think that sync and the freezer are different things and shouldn't be

mixed in

Quoted 5 lines

such a way as they are now.

Quoted 1 line

Does it actually fix FUSE?

It should prevent the freezer from deadlocking.

That's not the same thing. It's like saying "My footbrake grabs so I'll use the handbrake all the time. Take the stone out of the brake pad! :)

Quoted 3 lines
Quoted 1 line

Miklos claims sync is nop on FUSE...?

In that case there shouldn't be any deadlock, but a freezer failure. :-)

Isn't this scary? I'm agreeing with Pavel and the two of us seem to be disagreeing with everyone else!

To get more serious and practical though, I think the solution is to fuzz the userspace/kernelspace distinction. What we really want to do is freeze things that submit I/O, then sync, then freeze anything that processes I/O and needs to be frozen. In effect, redefine fuse processes as freezeable kernel threads.

Regards,

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#15 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

Quoted 5 lines

To get more serious and practical though, I think the solution is to fuzz the userspace/kernelspace distinction. What we really want to do is freeze things that submit I/O, then sync, then freeze anything that processes I/O and needs to be frozen. In effect, redefine fuse processes as freezeable kernel threads.

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

Miklos

#16 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

Hi.

Quoted 9 lines · On Friday 06 July 2007 17:13:27 Miklos Szeredi wrote:
Quoted 5 lines

To get more serious and practical though, I think the solution is to fuzz the userspace/kernelspace distinction. What we really want to do is freeze things that submit I/O, then sync, then freeze anything that processes I/O and needs to be frozen. In effect, redefine fuse processes as freezeable kernel threads.

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

No theoretical or practical way?! I'll freely admit to being quite ignorant about fuse, but surely there's some way by which they can be distinguished.

Regards,

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#17 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

In reply to Miklos Szeredi

Hi.

Quoted 9 lines · On Friday 06 July 2007 17:13:27 Miklos Szeredi wrote:
Quoted 5 lines

To get more serious and practical though, I think the solution is to fuzz the userspace/kernelspace distinction. What we really want to do is freeze things that submit I/O, then sync, then freeze anything that processes I/O and needs to be frozen. In effect, redefine fuse processes as freezeable kernel threads.

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

No theoretical or practical way?! I'll freely admit to being quite ignorant about fuse, but surely there's some way by which they can be distinguished.

Regards,

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#18 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

To get more serious and practical though, I think the solution is to fuzz the userspace/kernelspace distinction. What we really want to do is freeze things that submit I/O, then sync, then freeze anything that processes I/O and needs to be frozen. In effect, redefine fuse processes as freezeable kernel threads.

Quoted 6 lines
Quoted 3 lines

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

No theoretical or practical way?! I'll freely admit to being quite ignorant about fuse, but surely there's some way by which they can be distinguished.

How? OK, there are some tasks, that read and/or write /dev/fuse. And there are some that just communicate in some way with the above.

These could all be considered "fuse tasks", but those that don't do I/O on /dev/fuse are indistinguishable from non-fuse tasks.

And for example sshfs does have such a thread, which is in the reply chain, yet never communicates directly with the fuse kernel module.

Miklos

#19 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

In reply to Nigel Cunningham
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

To get more serious and practical though, I think the solution is to fuzz the userspace/kernelspace distinction. What we really want to do is freeze things that submit I/O, then sync, then freeze anything that processes I/O and needs to be frozen. In effect, redefine fuse processes as freezeable kernel threads.

Quoted 6 lines
Quoted 3 lines

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

No theoretical or practical way?! I'll freely admit to being quite ignorant about fuse, but surely there's some way by which they can be distinguished.

How? OK, there are some tasks, that read and/or write /dev/fuse. And there are some that just communicate in some way with the above.

These could all be considered "fuse tasks", but those that don't do I/O on /dev/fuse are indistinguishable from non-fuse tasks.

And for example sshfs does have such a thread, which is in the reply chain, yet never communicates directly with the fuse kernel module.

Miklos

#21 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

In reply to Miklos Szeredi
Quoted 4 lines · Miklos Szeredi

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

It could if they told the kernel via some black magic ...

But that still suck. The freezer sucks :-)

Ben.

#22 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

Quoted 9 lines · Miklos Szeredi
Quoted 4 lines

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

It could if they told the kernel via some black magic ...

But that still suck. The freezer sucks :-)

Yeah, and it wouldn't work in practice, since the auxilary tasks might be part of a library which is not even aware of being used by a "fuse task".

Miklos

#23 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

In reply to Benjamin Herrenschmidt
Quoted 9 lines · Miklos Szeredi
Quoted 4 lines

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

It could if they told the kernel via some black magic ...

But that still suck. The freezer sucks :-)

Yeah, and it wouldn't work in practice, since the auxilary tasks might be part of a library which is not even aware of being used by a "fuse task".

Miklos

#24 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

Hi.

Quoted 6 lines · On Friday 06 July 2007 19:05:53 Miklos Szeredi wrote:
Quoted 6 lines · Miklos Szeredi
Quoted 4 lines

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

Quoted 7 lines
Quoted 3 lines

It could if they told the kernel via some black magic ...

But that still suck. The freezer sucks :-)

Yeah, and it wouldn't work in practice, since the auxilary tasks might be part of a library which is not even aware of being used by a "fuse task".

This is why I think the whole concept of filesystems in userspace is broken. Trying to shift things that need special privilege and special handling to userspace is just asking for trouble. You can say it's the kernel code's fault, but then you have to explain why it's only fuse (yeah ok, and XFS) that have problems.

Regards,

Nigel

Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
#25 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines · Miklos Szeredi
Quoted 4 lines

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

It could if they told the kernel via some black magic ...

But that still suck. The freezer sucks :-)

Quoted 7 lines
Quoted 3 lines

Yeah, and it wouldn't work in practice, since the auxilary tasks might be part of a library which is not even aware of being used by a "fuse task".

This is why I think the whole concept of filesystems in userspace is broken. Trying to shift things that need special privilege and special handling to userspace is just asking for trouble.

I'm not claiming fuse doesn't introduce problems. I've been tackling those problems for a number of years now. Suspend/hibernate is just the next thing that needs looking at.

Just blaming either suspend or fuse for these problems is unproductive and stupid. The problems _are_ solvable if not always simply.

Quoted 2 lines

You can say it's the kernel code's fault, but then you have to explain why it's only fuse (yeah ok, and XFS) that have problems.

I'm not faulting anythig. My opinion, is that the freezer is not needed for suspend, and removing it will not just solve the problems with fuse but several others. It probably needs a lot of work, but hey, that's why we are here.

The patch posted by Rafael, which lets the freezer skip uninterrupible tasks is a step in the right direction.

Miklos

#26 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

Quoted 18 lines · Miklos Szeredi
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines · Miklos Szeredi
Quoted 4 lines

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

It could if they told the kernel via some black magic ...

But that still suck. The freezer sucks :-)

Quoted 7 lines
Quoted 3 lines

Yeah, and it wouldn't work in practice, since the auxilary tasks might be part of a library which is not even aware of being used by a "fuse task".

This is why I think the whole concept of filesystems in userspace is broken. Trying to shift things that need special privilege and special handling to userspace is just asking for trouble.

Quoted 6 lines

I'm not claiming fuse doesn't introduce problems. I've been tackling those problems for a number of years now. Suspend/hibernate is just the next thing that needs looking at.

Just blaming either suspend or fuse for these problems is unproductive and stupid.

Well, the "stupid" part is a bit offensive, don't you think?

Quoted 1 line

The problems _are_ solvable if not always simply.

Agreed.

Quoted 10 lines
Quoted 2 lines

You can say it's the kernel code's fault, but then you have to explain why it's only fuse (yeah ok, and XFS) that have problems.

I'm not faulting anythig. My opinion, is that the freezer is not needed for suspend, and removing it will not just solve the problems with fuse but several others. It probably needs a lot of work, but hey, that's why we are here.

The patch posted by Rafael, which lets the freezer skip uninterrupible tasks is a step in the right direction.

Thanks.

BTW, I think that this is just less radical than the change proposed by Matthew and it should address the underlying problems.

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#27 lore raw

Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer

In reply to Miklos Szeredi
Quoted 18 lines · Miklos Szeredi
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines · Miklos Szeredi
Quoted 4 lines

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

It could if they told the kernel via some black magic ...

But that still suck. The freezer sucks :-)

Quoted 7 lines
Quoted 3 lines

Yeah, and it wouldn't work in practice, since the auxilary tasks might be part of a library which is not even aware of being used by a "fuse task".

This is why I think the whole concept of filesystems in userspace is broken. Trying to shift things that need special privilege and special handling to userspace is just asking for trouble.

Quoted 6 lines

I'm not claiming fuse doesn't introduce problems. I've been tackling those problems for a number of years now. Suspend/hibernate is just the next thing that needs looking at.

Just blaming either suspend or fuse for these problems is unproductive and stupid.

Well, the "stupid" part is a bit offensive, don't you think?

Quoted 1 line

The problems _are_ solvable if not always simply.

Agreed.

Quoted 10 lines
Quoted 2 lines

You can say it's the kernel code's fault, but then you have to explain why it's only fuse (yeah ok, and XFS) that have problems.

I'm not faulting anythig. My opinion, is that the freezer is not needed for suspend, and removing it will not just solve the problems with fuse but several others. It probably needs a lot of work, but hey, that's why we are here.

The patch posted by Rafael, which lets the freezer skip uninterrupible tasks is a step in the right direction.

Thanks.

BTW, I think that this is just less radical than the change proposed by Matthew and it should address the underlying problems.

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#20 lore raw

possible solution for problem 2 (was Re: [RFC][PATCH -mm] PM: Do not sync filesystems from within the freezer)

In reply to Miklos Szeredi

Hi!

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

To get more serious and practical though, I think the solution is to fuzz the userspace/kernelspace distinction. What we really want to do is freeze things that submit I/O, then sync, then freeze anything that processes I/O and needs to be frozen. In effect, redefine fuse processes as freezeable kernel threads.

Another myth, that has been debunked already. The problem is: how do you define fuse processes? There's no theoretical or even practial way to do that.

Quoted 5 lines
Quoted 2 lines

No theoretical or practical way?! I'll freely admit to being quite ignorant about fuse, but surely there's some way by which they can be distinguished.

How? OK, there are some tasks, that read and/or write /dev/fuse. And there are some that just communicate in some way with the above.

(Not that I'm advocating this, but:)

You could ask fused to identify tasks involved in fuse handling. "Hey, fused, please give me list of PIDs".

Yes, that would be beyond ugly.

(I guess I'm advocating this:)

We probably can do variation on this. Notify fuse early that suspend is comming, so we can wait for all the fused requests to be flushed (/fusectl/*/waiting going to 0), and then just trap tasks trying to communicate with fuse in a sane place (i.e. not a place where VFS locks are held).

...I'm not saying this is a nice solution, but it should work... right...? And should work for hibernation, too...?

(at this point, we still have problem 1: something in s2ram path causes fuse to communicate with its frozen fused. It is not sync, so what is it?)
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html