public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Slight optimizations to entry.S patch
@ 2001-12-20 22:32 Alex
  2001-12-20 22:47 ` Davide Libenzi
  2001-12-21 16:49 ` Alan Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Alex @ 2001-12-20 22:32 UTC (permalink / raw)
  To: linux-kernel

Hi,
I was familiarizing (or trying to) myself with the i386 architecture code,
and saw a few possible optimizations. I think they can save a few cycles (not
that many). Can someone comment? Are the changes worthwhile?
-Alex K.

--- entry.S.orig	Thu Dec 20 16:57:39 2001
+++ entry.S	Thu Dec 20 17:20:29 2001
@@ -91,9 +91,9 @@
 	pushl %edi; \
 	pushl %esi; \
 	pushl %edx; \
+	movl $(__KERNEL_DS),%edx; \
 	pushl %ecx; \
 	pushl %ebx; \
-	movl $(__KERNEL_DS),%edx; \
 	movl %edx,%ds; \
 	movl %edx,%es;
 
@@ -141,13 +141,13 @@
 	movl EFLAGS(%esp),%ecx	# and this is cs..
 	movl %eax,EFLAGS(%esp)	#
 	movl %edx,EIP(%esp)	# Now we move them to their "normal" places
-	movl %ecx,CS(%esp)	#
 	movl %esp,%ebx
+	movl %ecx,CS(%esp)	#
 	pushl %ebx
 	andl $-8192,%ebx	# GET_CURRENT
 	movl exec_domain(%ebx),%edx	# Get the execution domain
-	movl 4(%edx),%edx	# Get the lcall7 handler for the domain
 	pushl $0x7
+	movl 4(%edx),%edx	# Get the lcall7 handler for the domain
 	call *%edx
 	addl $4, %esp
 	popl %eax
@@ -162,13 +162,13 @@
 	movl EFLAGS(%esp),%ecx	# and this is cs..
 	movl %eax,EFLAGS(%esp)	#
 	movl %edx,EIP(%esp)	# Now we move them to their "normal" places
-	movl %ecx,CS(%esp)	#
 	movl %esp,%ebx
+	movl %ecx,CS(%esp)	#
 	pushl %ebx
 	andl $-8192,%ebx	# GET_CURRENT
 	movl exec_domain(%ebx),%edx	# Get the execution domain
-	movl 4(%edx),%edx	# Get the lcall7 handler for the domain
 	pushl $0x27
+	movl 4(%edx),%edx	# Get the lcall7 handler for the domain
 	call *%edx
 	addl $4, %esp
 	popl %eax

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

* Re: Slight optimizations to entry.S patch
  2001-12-20 22:32 Slight optimizations to entry.S patch Alex
@ 2001-12-20 22:47 ` Davide Libenzi
  2001-12-20 23:55   ` Robert Love
  2001-12-21 16:49 ` Alan Cox
  1 sibling, 1 reply; 4+ messages in thread
From: Davide Libenzi @ 2001-12-20 22:47 UTC (permalink / raw)
  To: Alex; +Cc: lkml

On Thu, 20 Dec 2001, Alex wrote:

> Hi,
> I was familiarizing (or trying to) myself with the i386 architecture code,
> and saw a few possible optimizations. I think they can save a few cycles (not
> that many). Can someone comment? Are the changes worthwhile?

The first page of your x86 book starts talking about read-after-write
pipeline stall ? Damn what a book :)




- Davide




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

* Re: Slight optimizations to entry.S patch
  2001-12-20 22:47 ` Davide Libenzi
@ 2001-12-20 23:55   ` Robert Love
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Love @ 2001-12-20 23:55 UTC (permalink / raw)
  To: Davide Libenzi; +Cc: Alex, lkml

On Thu, 2001-12-20 at 17:47, Davide Libenzi wrote:

> The first page of your x86 book starts talking about read-after-write
> pipeline stall ? Damn what a book :)

Haha, he actually did help w.r.t to that ... good patch.  Sure, its
micro optimizations but not in any bad sense.  If it works, submit it.

I'll try it out on my next reboot.

	Robert Love


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

* Re: Slight optimizations to entry.S patch
  2001-12-20 22:32 Slight optimizations to entry.S patch Alex
  2001-12-20 22:47 ` Davide Libenzi
@ 2001-12-21 16:49 ` Alan Cox
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Cox @ 2001-12-21 16:49 UTC (permalink / raw)
  To: Alex; +Cc: linux-kernel

> I was familiarizing (or trying to) myself with the i386 architecture code,
> and saw a few possible optimizations. I think they can save a few cycles (not
> that many). Can someone comment? Are the changes worthwhile?

Measure them and see - look at the rdtsc instruction, run a million
iterations of all the various variants and see what you find

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

end of thread, other threads:[~2001-12-21 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-20 22:32 Slight optimizations to entry.S patch Alex
2001-12-20 22:47 ` Davide Libenzi
2001-12-20 23:55   ` Robert Love
2001-12-21 16:49 ` Alan Cox

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