From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: Yu Kuai <yukuai1@huaweicloud.com>,
song@kernel.org, logang@deltatee.com, pmenzel@molgen.mpg.de
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com,
"yukuai3@huawei.com >> yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v3 5/5] md/raid10: convert resync_lock to use seqlock
Date: Mon, 19 Sep 2022 18:28:29 +0800 [thread overview]
Message-ID: <b87f4f81-2514-5731-46b0-511b02e3420d@linux.dev> (raw)
In-Reply-To: <a6364e1e-f661-9e32-9d49-5ec421d77025@huaweicloud.com>
On 9/19/22 9:08 AM, Yu Kuai wrote:
> Hi,
>
> 在 2022/09/18 19:36, Guoqing Jiang 写道:
>>
>>
>> On 9/16/22 7:34 PM, Yu Kuai wrote:
>>> From: Yu Kuai <yukuai3@huawei.com>
>>>
>>> Currently, wait_barrier() will hold 'resync_lock' to read
>>> 'conf->barrier',
>>> and io can't be dispatched until 'barrier' is dropped.
>>>
>>> Since holding the 'barrier' is not common, convert 'resync_lock' to use
>>> seqlock so that holding lock can be avoided in fast path.
>>>
>>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>>> ---
>>> drivers/md/raid10.c | 87
>>> ++++++++++++++++++++++++++++++---------------
>>> drivers/md/raid10.h | 2 +-
>>> 2 files changed, 59 insertions(+), 30 deletions(-)
>>>
>>> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
>>> index 9a28abd19709..2daa7d57034c 100644
>>> --- a/drivers/md/raid10.c
>>> +++ b/drivers/md/raid10.c
>>> @@ -79,6 +79,21 @@ static void end_reshape(struct r10conf *conf);
>>> #include "raid1-10.c"
>>> +#define NULL_CMD
>>> +#define cmd_before(conf, cmd) \
>>> + do { \
>>> + write_sequnlock_irq(&(conf)->resync_lock); \
>>> + cmd; \
>>> + } while (0)
>>> +#define cmd_after(conf) write_seqlock_irq(&(conf)->resync_lock)
>>
>> The two is not paired well given only cmd_before needs the 'cmd'.
>
> May be should I just remove cmd_after?
I'd remove it but just my personal flavor.
>>
>>> +
>>> +#define wait_event_barrier_cmd(conf, cond, cmd) \
>>> + wait_event_cmd((conf)->wait_barrier, cond, cmd_before(conf,
>>> cmd), \
>>> + cmd_after(conf))
>>> +
>>> +#define wait_event_barrier(conf, cond) \
>>> + wait_event_barrier_cmd(conf, cond, NULL_CMD)
>>
>> What is the issue without define NULL_CMD?
>>
>
> Checkpatch will complain this:
>
> ERROR: space prohibited before that close parenthesis ')'
> #38: FILE: drivers/md/raid10.c:94:
> + wait_event_barrier_cmd(conf, cond, )
>
> total: 1 errors, 0 warnings, 169 lines checked
Hmm, freeze_array has a different usage for it, so two cmds before sleep
and one cmd after sleep, perhaps it is the best way for now.
Thanks,
Guoqing
next prev parent reply other threads:[~2022-09-19 10:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 11:34 [PATCH v3 0/5] md/raid10: reduce lock contention for io Yu Kuai
2022-09-16 11:34 ` [PATCH v3 1/5] md/raid10: factor out code from wait_barrier() to stop_waiting_barrier() Yu Kuai
2022-09-16 18:35 ` Logan Gunthorpe
2022-09-18 11:40 ` Guoqing Jiang
2022-09-16 11:34 ` [PATCH v3 2/5] md/raid10: don't modify 'nr_waitng' in wait_barrier() for the case nowait Yu Kuai
2022-09-16 18:35 ` Logan Gunthorpe
2022-09-18 11:40 ` Guoqing Jiang
2022-09-16 11:34 ` [PATCH v3 3/5] md/raid10: prevent unnecessary calls to wake_up() in fast path Yu Kuai
2022-09-16 18:36 ` Logan Gunthorpe
2022-09-18 11:38 ` Guoqing Jiang
2022-09-16 11:34 ` [PATCH v3 4/5] md/raid10: fix improper BUG_ON() in raise_barrier() Yu Kuai
2022-09-16 18:36 ` Logan Gunthorpe
2022-09-18 11:37 ` Guoqing Jiang
2022-09-16 11:34 ` [PATCH v3 5/5] md/raid10: convert resync_lock to use seqlock Yu Kuai
2022-09-16 18:37 ` Logan Gunthorpe
2022-09-18 11:36 ` Guoqing Jiang
2022-09-19 1:08 ` Yu Kuai
2022-09-19 10:28 ` Guoqing Jiang [this message]
2022-09-19 19:08 ` 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=b87f4f81-2514-5731-46b0-511b02e3420d@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=pmenzel@molgen.mpg.de \
--cc=song@kernel.org \
--cc=yi.zhang@huawei.com \
--cc=yukuai1@huaweicloud.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