LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch 14/14] syslets: x86: optimized sys_umem_add()
@ 2007-02-15 16:52 Ingo Molnar
  2007-02-15 18:23 ` Alexey Dobriyan
  0 siblings, 1 reply; 2+ messages in thread
From: Ingo Molnar @ 2007-02-15 16:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: Linus Torvalds, Arjan van de Ven, Christoph Hellwig,
	Andrew Morton, Alan Cox, Ulrich Drepper, Zach Brown,
	Evgeniy Polyakov, David S. Miller, Suparna Bhattacharya,
	Davide Libenzi, Thomas Gleixner


From: Ingo Molnar <mingo@elte.hu>

provide an optimized assembly version of sys_umem_add().
It is about 2 times faster than the C version.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
 arch/i386/lib/getuser.S |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Index: linux/arch/i386/lib/getuser.S
===================================================================
--- linux.orig/arch/i386/lib/getuser.S
+++ linux/arch/i386/lib/getuser.S
@@ -11,6 +11,33 @@
 #include <asm/thread_info.h>
 
 /*
+ * Optimized user-memory arithmetics system-call:
+ */
+
+.text
+.align 4
+.globl sys_umem_add
+sys_umem_add:
+	movl 0x4(%esp), %ecx			# uptr
+	movl 0x8(%esp), %edx			# inc
+
+	cmpl $__PAGE_OFFSET, %ecx		# access_ok(uptr)
+	jae bad_sys_umem_add
+
+1:	addl %edx, (%ecx)			# *uptr += inc
+2:	movl (%ecx), %eax			# return *uptr
+	ret
+
+bad_sys_umem_add:
+	movl $-14, %eax
+	ret
+
+.section __ex_table,"a"
+	.long 1b, bad_sys_umem_add
+	.long 2b, bad_sys_umem_add
+.previous
+
+/*
  * copy_uatom() - copy a syslet_atom from user-space into kernel-space:
  */
 

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

* Re: [patch 14/14] syslets: x86: optimized sys_umem_add()
  2007-02-15 16:52 [patch 14/14] syslets: x86: optimized sys_umem_add() Ingo Molnar
@ 2007-02-15 18:23 ` Alexey Dobriyan
  0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2007-02-15 18:23 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Linus Torvalds, Arjan van de Ven,
	Christoph Hellwig, Andrew Morton, Alan Cox, Ulrich Drepper,
	Zach Brown, Evgeniy Polyakov, David S. Miller,
	Suparna Bhattacharya, Davide Libenzi, Thomas Gleixner

On Thu, Feb 15, 2007 at 05:52:59PM +0100, Ingo Molnar wrote:
> provide an optimized assembly version of sys_umem_add().

> --- linux.orig/arch/i386/lib/getuser.S
> +++ linux/arch/i386/lib/getuser.S

> +sys_umem_add:
> +	movl 0x4(%esp), %ecx			# uptr
> +	movl 0x8(%esp), %edx			# inc
> +
> +	cmpl $__PAGE_OFFSET, %ecx		# access_ok(uptr)
> +	jae bad_sys_umem_add
> +
> +1:	addl %edx, (%ecx)			# *uptr += inc
> +2:	movl (%ecx), %eax			# return *uptr
> +	ret
> +
> +bad_sys_umem_add:
> +	movl $-14, %eax

We have EFAULT for this. ;-)

> +	ret
> +
> +.section __ex_table,"a"
> +	.long 1b, bad_sys_umem_add
> +	.long 2b, bad_sys_umem_add
> +.previous


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

end of thread, other threads:[~2007-02-15 18:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-15 16:52 [patch 14/14] syslets: x86: optimized sys_umem_add() Ingo Molnar
2007-02-15 18:23 ` Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).