Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Li Nan <linan666@huaweicloud.com>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: song@kernel.org, linux-raid@vger.kernel.org,
	linux-kernel@vger.kernel.org, linan122@huawei.com,
	yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com,
	yangerkun@huawei.com
Subject: Re: [PATCH 1/3] md/raid10: optimize fix_read_error
Date: Sun, 25 Jun 2023 14:44:58 +0800	[thread overview]
Message-ID: <adbdea88-2da6-e3c7-cb86-e75995e550f3@huaweicloud.com> (raw)
In-Reply-To: <d1778341-549e-6f88-0282-3096bfcd6614@molgen.mpg.de>



在 2023/6/23 18:03, Paul Menzel 写道:
> Dear Li,
> 
> 
> Thank you for your patch.
> 
> Am 23.06.23 um 19:32 schrieb linan666@huaweicloud.com:
>> From: Li Nan <linan122@huawei.com>
>>
>> We dereference r10_bio->read_slot too many times in fix_read_error().
>> Optimize it by using a variable to store read_slot.
> 
> I am always cautious reading about optimizations without any benchmarks 
> or object code analysis. Although your explanation makes sense, did you 
> check, that performance didn’t decrease in some way? (Maybe the compiler 
> even generates the same code.)
> 
> 
> Kind regards,
> 
> Paul
> 
> 

Compared assembly code before and after optimization:
  - With gcc 8.3.0, both are consistent.
  - With gcc 12.2.1, 'r10_bio->read_slot' mostly uses r10bio dirctly:
      2853    while (sl != r10_bio->read_slot) {
        0xffffffff8213f2a0 <+1328>:  cmp    %r14d,0x38(%rbp)

    'slot' is mostly saved to a register individually:
      2819    while (sl != slot) {
        0xffffffff8213f08a <+794>:   cmp    %r14d,%ebx

I have not tested the performance, and it won't bring significant 
performance optimization, which can also be seen from the analysis of 
the assembly code. In fact, I just want to make code more readable.

-- 
Thanks,
Nan


  reply	other threads:[~2023-06-25  6:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 17:32 [PATCH 0/3] md/raid10: optimize and fix read error linan666
2023-06-23  9:52 ` Paul Menzel
2023-06-25  1:23   ` Li Nan
2023-06-23 17:32 ` [PATCH 1/3] md/raid10: optimize fix_read_error linan666
2023-06-23 10:03   ` Paul Menzel
2023-06-25  6:44     ` Li Nan [this message]
2023-06-26  2:28   ` Yu Kuai
2023-06-23 17:32 ` [PATCH 2/3] md: remove redundant check in fix_read_error() linan666
2023-06-26  2:31   ` Yu Kuai
2023-06-23 17:32 ` [PATCH 3/3] md/raid10: handle replacement devices in fix_read_error linan666
2023-06-26  2:42   ` Yu Kuai
2023-07-07  8:16 ` [PATCH 0/3] md/raid10: optimize and fix read error Song Liu

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=adbdea88-2da6-e3c7-cb86-e75995e550f3@huaweicloud.com \
    --to=linan666@huaweicloud.com \
    --cc=houtao1@huawei.com \
    --cc=linan122@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=pmenzel@molgen.mpg.de \
    --cc=song@kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.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