All of lore.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: Xiao Ni <xni@redhat.com>
Cc: Song Liu <songliubraving@fb.com>,
	Nigel Croxon <ncroxon@redhat.com>,
	linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH 1/1] md/raid10: Remove rcu_dereference when it doesn't need rcu lock to protect
Date: Fri, 13 Aug 2021 09:49:53 -0700	[thread overview]
Message-ID: <CAPhsuW6iGBrdso3yStTxxv00qxLbW_gP_2H1CMsi5YzPFU5aqA@mail.gmail.com> (raw)
In-Reply-To: <1628481709-3824-1-git-send-email-xni@redhat.com>

On Sun, Aug 8, 2021 at 9:02 PM Xiao Ni <xni@redhat.com> wrote:
>
> In the first loop of function raid10_handle_discard. It already
> determines which disk need to handle discard request and add the
> rdev reference count. So the conf->mirrors will not change until
> all bios come back from underlayer disks. It doesn't need to use
> rcu_dereference to get rdev.
>
> Signed-off-by: Xiao Ni <xni@redhat.com>

Will we get performance benefits from this change? If not, I would
prefer to keep the code as-is.

Thanks,
Song

> ---
>  drivers/md/raid10.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 16977e8..cef9869 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -1743,9 +1743,8 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio)
>         for (disk = 0; disk < geo->raid_disks; disk++) {
>                 sector_t dev_start, dev_end;
>                 struct bio *mbio, *rbio = NULL;
> -               struct md_rdev *rdev = rcu_dereference(conf->mirrors[disk].rdev);
> -               struct md_rdev *rrdev = rcu_dereference(
> -                       conf->mirrors[disk].replacement);
> +               struct md_rdev *rdev = conf->mirrors[disk].rdev;
> +               struct md_rdev *rrdev = conf->mirrors[disk].replacement;
>
>                 /*
>                  * Now start to calculate the start and end address for each disk.
> --
> 2.7.5
>

  reply	other threads:[~2021-08-13 16:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  4:01 [PATCH 1/1] md/raid10: Remove rcu_dereference when it doesn't need rcu lock to protect Xiao Ni
2021-08-13 16:49 ` Song Liu [this message]
2021-08-14  1:34   ` Xiao Ni
2021-08-16  5:22     ` Song Liu
2021-08-16  8:58       ` Xiao Ni
2021-08-16  6:35 ` Guoqing Jiang
     [not found]   ` <CALTww2-YhNyKCyMjjviWJ4XmELNUZJonryrJfXtrwP4DU-C1zg@mail.gmail.com>
2021-08-16  9:33     ` Guoqing Jiang
2021-08-18  1:36 Xiao Ni
2021-08-18  1:43 ` Guoqing Jiang
2021-08-18  1:55   ` Xiao Ni

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=CAPhsuW6iGBrdso3yStTxxv00qxLbW_gP_2H1CMsi5YzPFU5aqA@mail.gmail.com \
    --to=song@kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=ncroxon@redhat.com \
    --cc=songliubraving@fb.com \
    --cc=xni@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.