linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: jens.axboe@fusionio.com
Cc: Mikulas Patocka <mpatocka@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [patch] block: make struct block_device cacheline_aligned
Date: Wed, 19 Sep 2012 09:50:40 -0400	[thread overview]
Message-ID: <x49lig686kv.fsf@segfault.boston.devel.redhat.com> (raw)

Hi,

When testing against a pcie ssd or a ramdisk, making the block device
structure cacheline_aligned provided a significant increase in
performance:

                                    vanilla
          	        READ                WRITE                 CPU          
  Job Name	     BW   IOPS  msec      BW   IOPS  msec   usr  sys   csw
    write1	      0      0     0  748522 187130 44864 16.34 60.65 3799440.00
     read1	 690615 172653 48602       0      0     0 13.45 61.42 4044720.00
randwrite1	      0      0     0  716406 179101 46839 29.03 52.79 3151140.00
 randread1	 683466 170866 49108       0      0     0 25.92 54.67 3081610.00
readwrite1	 377518  94379 44450  377645  94410 44450 15.49 64.32 3139240.00
   randrw1	 355815  88953 47178  355733  88933 47178 27.96 54.24 2944570.00

                                   patched
          	        READ                WRITE                 CPU          
  Job Name	     BW   IOPS  msec      BW   IOPS  msec   usr  sys   csw
    write1	      0      0     0  871355 217838 38508 17.49 42.46 1642870.00
     read1	1418560 354639 23675       0      0     0 14.96 54.75 337489.00
randwrite1	      0      0     0  736970 184242 45633 30.62 35.25 1409440.00
 randread1	1065440 266359 31544       0      0     0 32.67 43.74 255394.00
readwrite1	 657940 164484 25867  657848 164461 25867 18.54 50.55 619474.00
   randrw1	 491940 122985 34245  492014 123003 34245 34.44 41.05 418999.00

                                   %diff
          	        READ                WRITE                 CPU          
  Job Name	     BW   IOPS  msec      BW   IOPS  msec   usr  sys   csw
    write1	      0      0     0      16     16   -14 7.04 -29.99 -56.76
     read1	    105    105   -51       0      0     0 11.23 -10.86 -91.66
randwrite1	      0      0     0       0      0     0 5.48 -33.23 -55.27
 randread1	     55     55   -35       0      0     0 26.04 -19.99 -91.71
readwrite1	     74     74   -41      74     74   -41 19.69 -21.41 -80.27
   randrw1	     38     38   -27      38     38   -27 23.18 -24.32 -85.77

BW=bandwidth in KB/s
IOPS = I/Os per second
msec = # of miliseconds the run took (lower is better)
usr = % user time
sys = % system time
csw = # of context switches

The test is doing asynchronous direct I/O to the block device using 4
processes each driving a queue depth of 1024 to a different part of the
disk.  The rows, in order, are sequential write, sequential read,
random write, random read, 50% mix of sequential reads and sequential
writes, 50% mix of random reads and random writes.  The block size in
all cases is 4k.

I'd appreciate it if others could verify an increase in performance with
this patch.  Thanks to Mikulas for initially suggesting that the cache
size/alignment was relevant to performance.

Cheers,
Jeff

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/include/linux/fs.h b/include/linux/fs.h
index aa11047..87ce6ca 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -724,7 +724,7 @@ struct block_device {
 	int			bd_fsfreeze_count;
 	/* Mutex for freeze */
 	struct mutex		bd_fsfreeze_mutex;
-};
+} __cacheline_aligned;
 
 /*
  * Radix-tree tags, for tagging dirty and writeback pages within the pagecache

             reply	other threads:[~2012-09-19 13:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 13:50 Jeff Moyer [this message]
2012-09-19 14:59 ` [patch] block: make struct block_device cacheline_aligned Jeff Moyer
2012-09-19 15:16   ` Mikulas Patocka
2012-09-19 15:24     ` Jeff Moyer
2012-09-19 15:50       ` Mikulas Patocka
2012-09-19 16:44         ` Jeff Moyer
2012-09-20  0:11           ` Mikulas Patocka
2012-09-19 15:32   ` Richard Kennedy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x49lig686kv.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=jens.axboe@fusionio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).