linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kiobuf_init optimization
@ 2001-10-03 21:47 Bond, Andrew
  2001-10-04  0:35 ` chris
  0 siblings, 1 reply; 3+ messages in thread
From: Bond, Andrew @ 2001-10-03 21:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Nikolaiev, Mike, Jamshed Patel (E-mail)

[-- Attachment #1: Type: text/plain, Size: 2045 bytes --]

	I have come up with a change to the kiobuf_init() routine that
drops the blind memset() to 0 of the entire kiobuf structure and zeros
out 3 specific fields instead.  Since this is done on every IO and the
kiobuf structure is over 8K in size (8756 bytes I believe) it becomes
quite costly from a cpu cycle perspective as well as a cache utilization
perspective.  The typical IO path uses a small subset of the
preallocated fields within the kiobuf structure.  Therefore, the IO path
pays a performance penalty for having to zero out many fields that it
typically doesn't use.

	The kiobuf_init() routine using a memset() of the entire kiobuf
structure is in the top 10 of cpu consuming kernel routines in Oracle 9i
testing using raw io.  Using the included kiobuf_init patch, our testing
has shown a 5% improvement in Oracle transactional performance in 4 and
8 processor configurations, and the kiobuf_init() routine became a
non-issue for performance.  The testing was performed with Oracle, but
this patch could provide performance improvements to any application
that uses raw IO or relies on kiobufs in the IO path.

	Obviously, since the structure is no longer set to zero, any
code that makes a zero assumption would break.  I haven't come across
code that makes this assumption yet for fields that I did not
specifically zero out in the patch, but I could very well be missing
something.  It appears that Alan has included this patch in his
2.4.10-ac4 tree.  So, let me know if you have any problems that you
think might be related to this patch.   Any input would be greatly
appreciated.

	The patch is against a 2.4.9 tree, but it is localized to just
the kiobuf_init() routine and should apply to any of the recent kernels.

	Run from the root level of your kernel tree:  
		patch -p1 < kiobuf_init_speedup.patch 

	I cannot currently receive the kernel mailing list at this email
address, so please cc: me on posts related to this patch.

Thanks,
Andrew Bond

 <<kiobuf_init_speedup.patch>> 

[-- Attachment #2: kiobuf_init_speedup.patch --]
[-- Type: application/octet-stream, Size: 464 bytes --]

--- linux-2.4.9/fs/iobuf.c	Fri Sep 28 13:57:21 2001
+++ linux-2.4.9_prof/fs/iobuf.c	Wed Oct  3 21:09:51 2001
@@ -43,10 +43,12 @@
 
 static void kiobuf_init(struct kiobuf *iobuf)
 {
-	memset(iobuf, 0, sizeof(*iobuf));
 	init_waitqueue_head(&iobuf->wait_queue);
 	iobuf->array_len = KIO_STATIC_PAGES;
 	iobuf->maplist   = iobuf->map_array;
+	iobuf->nr_pages = 0;
+	iobuf->locked = 0;
+	iobuf->io_count.counter = 0;
 }
 
 int alloc_kiobuf_bhs(struct kiobuf * kiobuf)

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

* Re: [PATCH] kiobuf_init optimization
  2001-10-03 21:47 [PATCH] kiobuf_init optimization Bond, Andrew
@ 2001-10-04  0:35 ` chris
  0 siblings, 0 replies; 3+ messages in thread
From: chris @ 2001-10-04  0:35 UTC (permalink / raw)
  To: Bond, Andrew; +Cc: linux-kernel, Nikolaiev, Mike, Jamshed Patel (E-mail)


Hi,

Have a look at 2.4.10 - I believe this has a similar optimization?
Re-running your benchmark against plain 2.4.10 would be interesting.

Cheers
Chris

On Wed, 3 Oct 2001, Bond, Andrew wrote:

> 	I have come up with a change to the kiobuf_init() routine that
> drops the blind memset() to 0 of the entire kiobuf structure and zeros
> out 3 specific fields instead.  Since this is done on every IO and the
> kiobuf structure is over 8K in size (8756 bytes I believe) it becomes
> quite costly from a cpu cycle perspective as well as a cache utilization
> perspective.  The typical IO path uses a small subset of the
> preallocated fields within the kiobuf structure.  Therefore, the IO path
> pays a performance penalty for having to zero out many fields that it
> typically doesn't use.
>
> 	The kiobuf_init() routine using a memset() of the entire kiobuf
> structure is in the top 10 of cpu consuming kernel routines in Oracle 9i
> testing using raw io.  Using the included kiobuf_init patch, our testing
> has shown a 5% improvement in Oracle transactional performance in 4 and
> 8 processor configurations, and the kiobuf_init() routine became a
> non-issue for performance.  The testing was performed with Oracle, but
> this patch could provide performance improvements to any application
> that uses raw IO or relies on kiobufs in the IO path.
>
> 	Obviously, since the structure is no longer set to zero, any
> code that makes a zero assumption would break.  I haven't come across
> code that makes this assumption yet for fields that I did not
> specifically zero out in the patch, but I could very well be missing
> something.  It appears that Alan has included this patch in his
> 2.4.10-ac4 tree.  So, let me know if you have any problems that you
> think might be related to this patch.   Any input would be greatly
> appreciated.
>
> 	The patch is against a 2.4.9 tree, but it is localized to just
> the kiobuf_init() routine and should apply to any of the recent kernels.
>
> 	Run from the root level of your kernel tree:
> 		patch -p1 < kiobuf_init_speedup.patch
>
> 	I cannot currently receive the kernel mailing list at this email
> address, so please cc: me on posts related to this patch.
>
> Thanks,
> Andrew Bond
>
>  <<kiobuf_init_speedup.patch>>
>


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

* RE: [PATCH] kiobuf_init optimization
@ 2001-10-03 23:48 Robert_Macaulay
  0 siblings, 0 replies; 3+ messages in thread
From: Robert_Macaulay @ 2001-10-03 23:48 UTC (permalink / raw)
  To: Andrew.Bond, linux-kernel; +Cc: Mike.Nikolaiev, Jamshed.Patel

[-- Attachment #1: Type: text/plain, Size: 2461 bytes --]

We expierenced a panic when starting Oracle 8i with your patch(actually ac4)
right after the database was mounted. I will forward you the oops I posted
earlier today.

-----Original Message----- 
From: Bond, Andrew 
Sent: Wed 10/3/2001 4:47 PM 
To: linux-kernel@vger.kernel.org 
Cc: Nikolaiev, Mike; Jamshed Patel (E-mail) 
Subject: [PATCH] kiobuf_init optimization



        I have come up with a change to the kiobuf_init() routine that 
drops the blind memset() to 0 of the entire kiobuf structure and zeros 
out 3 specific fields instead.  Since this is done on every IO and the 
kiobuf structure is over 8K in size (8756 bytes I believe) it becomes 
quite costly from a cpu cycle perspective as well as a cache utilization 
perspective.  The typical IO path uses a small subset of the 
preallocated fields within the kiobuf structure.  Therefore, the IO path 
pays a performance penalty for having to zero out many fields that it 
typically doesn't use. 

        The kiobuf_init() routine using a memset() of the entire kiobuf 
structure is in the top 10 of cpu consuming kernel routines in Oracle 9i 
testing using raw io.  Using the included kiobuf_init patch, our testing 
has shown a 5% improvement in Oracle transactional performance in 4 and 
8 processor configurations, and the kiobuf_init() routine became a 
non-issue for performance.  The testing was performed with Oracle, but 
this patch could provide performance improvements to any application 
that uses raw IO or relies on kiobufs in the IO path. 

        Obviously, since the structure is no longer set to zero, any 
code that makes a zero assumption would break.  I haven't come across 
code that makes this assumption yet for fields that I did not 
specifically zero out in the patch, but I could very well be missing 
something.  It appears that Alan has included this patch in his 
2.4.10-ac4 tree.  So, let me know if you have any problems that you 
think might be related to this patch.   Any input would be greatly 
appreciated. 

        The patch is against a 2.4.9 tree, but it is localized to just 
the kiobuf_init() routine and should apply to any of the recent kernels. 

        Run from the root level of your kernel tree:  
                patch -p1 < kiobuf_init_speedup.patch 

        I cannot currently receive the kernel mailing list at this email 
address, so please cc: me on posts related to this patch. 

Thanks, 
Andrew Bond 

 <<kiobuf_init_speedup.patch>> 


[-- Attachment #2: Type: application/ms-tnef, Size: 6414 bytes --]

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

end of thread, other threads:[~2001-10-04  0:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-03 21:47 [PATCH] kiobuf_init optimization Bond, Andrew
2001-10-04  0:35 ` chris
2001-10-03 23:48 Robert_Macaulay

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).