* [PATCH] md:Add blk_plug in sync_thread.
@ 2012-06-11 9:16 majianpeng
2012-06-11 9:32 ` Nagilum
2012-06-27 2:30 ` NeilBrown
0 siblings, 2 replies; 5+ messages in thread
From: majianpeng @ 2012-06-11 9:16 UTC (permalink / raw)
To: Neil Brown; +Cc: linux-raid
Add blk_plug in sync_thread will increase the performance of sync.
Because sync_thread did not blk_plug,so when raid sync, the bio merge
not well.
Testing environment:
SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI
Controller.
OS:Linux xxx 3.5.0-rc2+ #340 SMP Tue Jun 12 09:00:25 CST 2012
x86_64 x86_64 x86_64 GNU/Linux.
RAID5: four ST31000524NS disk.
Without blk_plug:recovery speed about 63M/Sec;
Add blk_plug:recovery speed about 120M/Sec.
Using blktrace:
blktrace -d /dev/sdb -w 60 -o -|blkparse -i -
without blk_plug:
Total (8,16):
Reads Queued: 309811, 1239MiB Writes Queued: 0, 0KiB
Read Dispatches: 283583, 1189MiB Write Dispatches: 0, 0KiB
Reads Requeued: 0 Writes Requeued: 0
Reads Completed: 273351, 1149MiB Writes Completed: 0, 0KiB
Read Merges: 23533, 94132KiB Write Merges: 0, 0KiB
IO unplugs: 0 Timer unplugs: 0
add blk_plug:
Total (8,16):
Reads Queued: 428697, 1714MiB Writes Queued: 0, 0KiB
Read Dispatches: 3954, 1714MiB Write Dispatches: 0, 0KiB
Reads Requeued: 0 Writes Requeued: 0
Reads Completed: 3956, 1715MiB Writes Completed: 0, 0KiB
Read Merges: 424743, 1698MiB Write Merges: 0, 0KiB
IO unplugs: 0 Timer unplugs: 3384
The ratio of merge will be markedly increased.
Signed-off-by: majianpeng <majianpeng@gmail.com>
---
drivers/md/md.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1c2f904..90bdc37 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7298,6 +7298,7 @@ void md_do_sync(struct mddev *mddev)
int skipped = 0;
struct md_rdev *rdev;
char *desc;
+ struct blk_plug plug;
/* just incase thread restarts... */
if (test_bit(MD_RECOVERY_DONE, &mddev->recovery))
@@ -7446,7 +7447,8 @@ void md_do_sync(struct mddev *mddev)
mddev->curr_resync = j;
}
mddev->curr_resync_completed = j;
-
+
+ blk_start_plug(&plug);
while (j < max_sectors) {
sector_t sectors;
@@ -7586,6 +7588,7 @@ void md_do_sync(struct mddev *mddev)
}
skip:
set_bit(MD_CHANGE_DEVS, &mddev->flags);
+ blk_finish_plug(&plug);
if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
/* We completed so min/max setting can be forgotten if used. */
--
1.7.5.4
--------------
majianpeng
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] md:Add blk_plug in sync_thread.
2012-06-11 9:16 [PATCH] md:Add blk_plug in sync_thread majianpeng
@ 2012-06-11 9:32 ` Nagilum
2012-06-11 10:11 ` majianpeng
2012-06-27 2:30 ` NeilBrown
1 sibling, 1 reply; 5+ messages in thread
From: Nagilum @ 2012-06-11 9:32 UTC (permalink / raw)
To: majianpeng; +Cc: Neil Brown, linux-raid
On 06/11/2012 11:16 AM, majianpeng wrote:
> Add blk_plug in sync_thread will increase the performance of sync.
> Because sync_thread did not blk_plug,so when raid sync, the bio merge
> not well.
>
> Testing environment:
> SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI
> Controller.
> OS:Linux xxx 3.5.0-rc2+ #340 SMP Tue Jun 12 09:00:25 CST 2012
> x86_64 x86_64 x86_64 GNU/Linux.
> RAID5: four ST31000524NS disk.
>
> Without blk_plug:recovery speed about 63M/Sec;
> Add blk_plug:recovery speed about 120M/Sec.
Whahoo!! :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: [PATCH] md:Add blk_plug in sync_thread.
2012-06-11 9:32 ` Nagilum
@ 2012-06-11 10:11 ` majianpeng
2012-06-11 10:30 ` Nagilum
0 siblings, 1 reply; 5+ messages in thread
From: majianpeng @ 2012-06-11 10:11 UTC (permalink / raw)
To: Nagilum; +Cc: Neil Brown, linux-raid
On Mon, 11 Jun 2012 02:32:57 najilum wrote:
>On 06/11/2012 11:16 AM, majianpeng wrote:
>> Add blk_plug in sync_thread will increase the performance of sync.
>> Because sync_thread did not blk_plug,so when raid sync, the bio merge
>> not well.
>>
>> Testing environment:
>> SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI
>> Controller.
>> OS:Linux xxx 3.5.0-rc2+ #340 SMP Tue Jun 12 09:00:25 CST 2012
>> x86_64 x86_64 x86_64 GNU/Linux.
>> RAID5: four ST31000524NS disk.
>>
>> Without blk_plug:recovery speed about 63M/Sec;
>> Add blk_plug:recovery speed about 120M/Sec.
>Whahoo!! :)
What's mean ?
>
--------------
majianpeng
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] md:Add blk_plug in sync_thread.
2012-06-11 10:11 ` majianpeng
@ 2012-06-11 10:30 ` Nagilum
0 siblings, 0 replies; 5+ messages in thread
From: Nagilum @ 2012-06-11 10:30 UTC (permalink / raw)
To: majianpeng; +Cc: Neil Brown, linux-raid
On 06/11/2012 12:11 PM, majianpeng wrote:
> On Mon, 11 Jun 2012 02:32:57 najilum wrote:
>> On 06/11/2012 11:16 AM, majianpeng wrote:
>>> Add blk_plug in sync_thread will increase the performance of sync.
>>> Because sync_thread did not blk_plug,so when raid sync, the bio merge
>>> not well.
>>>
>>> Testing environment:
>>> SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI
>>> Controller.
>>> OS:Linux xxx 3.5.0-rc2+ #340 SMP Tue Jun 12 09:00:25 CST 2012
>>> x86_64 x86_64 x86_64 GNU/Linux.
>>> RAID5: four ST31000524NS disk.
>>>
>>> Without blk_plug:recovery speed about 63M/Sec;
>>> Add blk_plug:recovery speed about 120M/Sec.
>> Whahoo!! :)
> What's mean ?
Almost doubled the performance with one simple change, that's great! :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] md:Add blk_plug in sync_thread.
2012-06-11 9:16 [PATCH] md:Add blk_plug in sync_thread majianpeng
2012-06-11 9:32 ` Nagilum
@ 2012-06-27 2:30 ` NeilBrown
1 sibling, 0 replies; 5+ messages in thread
From: NeilBrown @ 2012-06-27 2:30 UTC (permalink / raw)
To: majianpeng; +Cc: linux-raid
[-- Attachment #1: Type: text/plain, Size: 2975 bytes --]
On Mon, 11 Jun 2012 17:16:55 +0800 majianpeng <majianpeng@gmail.com> wrote:
> Add blk_plug in sync_thread will increase the performance of sync.
> Because sync_thread did not blk_plug,so when raid sync, the bio merge
> not well.
>
> Testing environment:
> SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI
> Controller.
> OS:Linux xxx 3.5.0-rc2+ #340 SMP Tue Jun 12 09:00:25 CST 2012
> x86_64 x86_64 x86_64 GNU/Linux.
> RAID5: four ST31000524NS disk.
>
> Without blk_plug:recovery speed about 63M/Sec;
> Add blk_plug:recovery speed about 120M/Sec.
>
> Using blktrace:
> blktrace -d /dev/sdb -w 60 -o -|blkparse -i -
>
> without blk_plug:
> Total (8,16):
> Reads Queued: 309811, 1239MiB Writes Queued: 0, 0KiB
> Read Dispatches: 283583, 1189MiB Write Dispatches: 0, 0KiB
> Reads Requeued: 0 Writes Requeued: 0
> Reads Completed: 273351, 1149MiB Writes Completed: 0, 0KiB
> Read Merges: 23533, 94132KiB Write Merges: 0, 0KiB
> IO unplugs: 0 Timer unplugs: 0
>
> add blk_plug:
> Total (8,16):
> Reads Queued: 428697, 1714MiB Writes Queued: 0, 0KiB
> Read Dispatches: 3954, 1714MiB Write Dispatches: 0, 0KiB
> Reads Requeued: 0 Writes Requeued: 0
> Reads Completed: 3956, 1715MiB Writes Completed: 0, 0KiB
> Read Merges: 424743, 1698MiB Write Merges: 0, 0KiB
> IO unplugs: 0 Timer unplugs: 3384
>
> The ratio of merge will be markedly increased.
>
> Signed-off-by: majianpeng <majianpeng@gmail.com>
> ---
> drivers/md/md.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 1c2f904..90bdc37 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -7298,6 +7298,7 @@ void md_do_sync(struct mddev *mddev)
> int skipped = 0;
> struct md_rdev *rdev;
> char *desc;
> + struct blk_plug plug;
>
> /* just incase thread restarts... */
> if (test_bit(MD_RECOVERY_DONE, &mddev->recovery))
> @@ -7446,7 +7447,8 @@ void md_do_sync(struct mddev *mddev)
> mddev->curr_resync = j;
> }
> mddev->curr_resync_completed = j;
> -
> +
> + blk_start_plug(&plug);
> while (j < max_sectors) {
> sector_t sectors;
>
> @@ -7586,6 +7588,7 @@ void md_do_sync(struct mddev *mddev)
> }
> skip:
> set_bit(MD_CHANGE_DEVS, &mddev->flags);
> + blk_finish_plug(&plug);
>
> if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
> /* We completed so min/max setting can be forgotten if used. */
Thanks again.
I've moved the call to "blk_finish_plug" up a bit to just after the
out:
label, as it is possible to "goto skip" before calling blk_start_plug.
Thanks a lot,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-27 2:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-11 9:16 [PATCH] md:Add blk_plug in sync_thread majianpeng
2012-06-11 9:32 ` Nagilum
2012-06-11 10:11 ` majianpeng
2012-06-11 10:30 ` Nagilum
2012-06-27 2:30 ` NeilBrown
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).