mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][RFC] swsusp: speed up image restoring on x86-64
@ 2005-01-20 19:32 Rafael J. Wysocki
  2005-01-20 20:59 ` Pavel Machek
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Rafael J. Wysocki @ 2005-01-20 19:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, LKML, Pavel Machek

Hi,

The following patch speeds up the restoring of swsusp images on x86-64
and makes the assembly code more readable (tested and works on AMD64).  It's
against 2.6.11-rc1-mm1, but applies to 2.6.11-rc1-mm2.  Please consifer for applying.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

--- linux-2.6.11-rc1-mm1/arch/x86_64/kernel/suspend_asm.S	2004-12-24 22:35:28.000000000 +0100
+++ linux-2.6.11-rc1-mm1-rjw/arch/x86_64/kernel/suspend_asm.S	2005-01-20 17:28:30.000000000 +0100
@@ -49,43 +49,28 @@
 	movq	%rcx, %cr3;
 	movq	%rax, %cr4;  # turn PGE back on
 
+	movq	pagedir_nosave(%rip), %rdx
+	/* compute the limit */
 	movl	nr_copy_pages(%rip), %eax
-	xorl	%ecx, %ecx
-	movq	$0, %r10
 	testl	%eax, %eax
 	jz	done
-.L105:
-	xorl	%esi, %esi
-	movq	$0, %r11
-	jmp	.L104
-	.p2align 4,,7
-copy_one_page:
-	movq	%r10, %rcx
-.L104:
-	movq	pagedir_nosave(%rip), %rdx
-	movq	%rcx, %rax
-	salq	$5, %rax
-	movq	8(%rdx,%rax), %rcx
-	movq	(%rdx,%rax), %rax
-	movzbl	(%rsi,%rax), %eax
-	movb	%al, (%rsi,%rcx)
+	shlq	$5, %rax; # multiply by sizeof(struct pbe)
+	addq	%rdx, %rax
+loop:
+	/* get addresses from the pbe and copy the page */
+	movq	(%rdx), %rsi
+	movq	8(%rdx), %rdi
+	movq	$512, %rcx
+	rep
+	movsq
 
-	movq	%cr3, %rax;  # flush TLB
-	movq	%rax, %cr3;
+	movq	%cr3, %rcx;  # flush TLB
+	movq	%rcx, %cr3;
 
-	movq	%r11, %rax
-	incq	%rax
-	cmpq	$4095, %rax
-	movq	%rax, %rsi
-	movq	%rax, %r11
-	jbe	copy_one_page
-	movq	%r10, %rax
-	incq	%rax
-	movq	%rax, %rcx
-	movq	%rax, %r10
-	mov	nr_copy_pages(%rip), %eax
-	cmpq	%rax, %rcx
-	jb	.L105
+	/* progress to the next pbe */
+	addq	$32, %rdx; # add sizeof(struct pbe)
+	cmpq	%rax, %rdx
+	jb	loop
 done:
 	movl	$24, %eax
 	movl	%eax, %ds



Greets,
RJW


-- 
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2005-01-22 11:45 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-20 19:32 [PATCH][RFC] swsusp: speed up image restoring on x86-64 Rafael J. Wysocki
2005-01-20 20:59 ` Pavel Machek
2005-01-20 21:46   ` Rafael J. Wysocki
2005-01-20 22:06     ` Pavel Machek
2005-01-20 22:58       ` Rafael J. Wysocki
2005-01-20 23:06         ` Pavel Machek
2005-01-21  0:14           ` Rafael J. Wysocki
2005-01-21 10:06             ` Pavel Machek
2005-01-21 12:43               ` Rafael J. Wysocki
2005-01-21  2:23     ` hugang
2005-01-21 10:04       ` Pavel Machek
2005-01-21 10:19         ` Andi Kleen
2005-01-21 10:30       ` Pavel Machek
2005-01-21 13:42         ` Rafael J. Wysocki
2005-01-21 14:31           ` hugang
2005-01-21 17:48           ` Pavel Machek
2005-01-21 12:32       ` Rafael J. Wysocki
2005-01-21 19:09         ` Rafael J. Wysocki
2005-01-22  2:03     ` Andi Kleen
2005-01-20 21:04 ` Rafael J. Wysocki
2005-01-22  2:50 ` Andi Kleen
2005-01-22  9:54   ` Pavel Machek
2005-01-22 11:26     ` Andi Kleen
2005-01-22 11:30       ` Pavel Machek
2005-01-22 11:44         ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome