Thread (7 messages) 7 messages, 3 authors, 2012-03-25

Re: Possible Swapfile bug

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2012-03-22 19:46:38

On Thu, 22 Mar 2012 10:24:22 -0600
Jason Mattax [off-list ref] wrote:
Swapon very slow with swapfiles.

After upgrading the kernel my swap file loads very slowly, while a swap 
partition is unaffected. With the newer kernel (2.6.33.1) I get

# time swapon -v /var/swapfile
swapon on /var/swapfile
swapon: /var/swapfile: found swap signature: version 1, page-size 4, 
same byte order
swapon: /var/swapfile: pagesize=4096, swapsize=6442450944, 
devsize=6442450944

real    4m35.355s
user    0m0.001s
sys    0m1.786s

while with the older kernel (2.6.32.27) I get
# time swapon -v /var/swapfile
swapon on /var/swapfile
swapon: /var/swapfile: found swap signature: version 1, page-size 4, 
same byte order
swapon: /var/swapfile: pagesize=4096, swapsize=6442450944, 
devsize=6442450944

real    0m1.158s
user    0m0.000s
sys     0m0.876s

this stays true even for new swapfiles I create with dd.

the file is on an OCZ Vertex2 SSD.
Probably the vertex2 discard problem.  

We just merged a patch which will hopefully fix it:
--- a/mm/swapfile.c~swap-dont-do-discard-if-no-discard-option-added
+++ a/mm/swapfile.c
@@ -2103,7 +2103,7 @@ SYSCALL_DEFINE2(swapon, const char __use
 			p->flags |= SWP_SOLIDSTATE;
 			p->cluster_next = 1 + (random32() % p->highest_bit);
 		}
-		if (discard_swap(p) == 0 && (swap_flags & SWAP_FLAG_DISCARD))
+		if ((swap_flags & SWAP_FLAG_DISCARD) && discard_swap(p) == 0)
 			p->flags |= SWP_DISCARDABLE;
 	}
 
But Hugh doesn't like it and won't tell us why :)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help