Skip to contentSkip to conversation

Documentation: power: swsusp: Fix script for unswapping

PATCH In review Pali Rohár 2 participants 2 messages May 6, 2014 – Aug 16, 2014 Suspend to RAM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: power: swsusp: Fix script for unswapping

System can have mmaped also character devices (e.g dri devices by X) or deleted files. Running cat on character devices is really bad idea (system can hang) so run cat only on regular files. Also mmaped files can have spaces in filenames.

---
 Documentation/power/swsusp.txt |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/power/swsusp.txt +4 -1
index 079160e..f732a83 100644
@@ -220,7 +220,10 @@ Q: After resuming, system is paging heavily, leading to very bad interactivity.
 
 A: Try running
 
-cat `cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u` > /dev/null
+cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u | while read file
+do
+  test -f "$file" && cat "$file" > /dev/null
+done
 
 after resume. swapoff -a; swapon -a may also be useful.
 
Signature · 1 line
1.7.9.5
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Pali Roh?r

System can have mmaped also character devices (e.g dri devices by X) or deleted files. Running cat on character devices is really bad idea (system can hang) so run cat only on regular files. Also mmaped files can have spaces in filenames.

Quoted 22 lines
---
 Documentation/power/swsusp.txt |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/power/swsusp.txt +4 -1
index 079160e..f732a83 100644
@@ -220,7 +220,10 @@ Q: After resuming, system is paging heavily, leading to very bad interactivity.
 
 A: Try running
 
-cat `cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u` > /dev/null
+cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u | while read file
+do
+  test -f "$file" && cat "$file" > /dev/null
+done
 
 after resume. swapoff -a; swapon -a may also be useful.
 
Signature · 1 line
1.7.9.5
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html