From: Su Yue <l@damenly.org>
To: Xiao Ni <xni@redhat.com>
Cc: Yu Kuai <yukuai1@huaweicloud.com>,
Nigel Croxon <ncroxon@redhat.com>,
linux-raid@vger.kernel.org, Song Liu <song@kernel.org>,
Jonathan Derrick <jonathan.derrick@linux.dev>,
"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: md bitmap writes random memory over disks' bitmap sectors
Date: Mon, 03 Mar 2025 23:10:35 +0800 [thread overview]
Message-ID: <o6yip2tw.fsf@damenly.org> (raw)
In-Reply-To: <CALTww2_BtecKOjJy+2xDAeAB26BgOhHF8fk-=ksjThebATdeKQ@mail.gmail.com> (Xiao Ni's message of "Fri, 28 Feb 2025 15:46:39 +0800")
On Fri 28 Feb 2025 at 15:46, Xiao Ni <xni@redhat.com> wrote:
> On Fri, Feb 28, 2025 at 10:07 AM Yu Kuai
> <yukuai1@huaweicloud.com> wrote:
>>
>> Hi,
>>
>> 在 2025/02/25 23:32, Nigel Croxon 写道:
>> > - md_super_write(mddev, rdev, sboff + ps, (int) size,
>> > page);
>> > + md_super_write(mddev, rdev, sboff + ps,
>> > (int)min(size,
>> > bitmap_limit), page);
>> > return 0;
>> >
>> > This patch still will attempt to send writes greater than a
>> > page using
>> > only a single page pointer for multi-page bitmaps. The bitmap
>> > uses an
>> > array (the filemap) of pages when the bitmap cannot fit in a
>> > single
>> > page. These pages are allocated separately and not guaranteed
>> > to be
>> > contiguous. So this patch will keep writes in a multi-page
>> > bitmap from
>> > trashing data beyond the bitmap, but can create writes which
>> > corrupt
>> > other parts of the bitmap with random memory.
>>
>> Is this problem introduced by:
>>
>> 8745faa95611 ("md: Use optimal I/O size for last bitmap page")
>
> I think so.
>
>>
>> >
>> > The opt using logic in this function is fundamentally flawed
>> > as
>> > __write_sb_page should never send a write bigger than a page
>> > at a time.
>> > It would need to use a new interface which can build
>> > multi-page bio and
>> > not md_super_write() if it wanted to send multi-page I/Os.
>>
>> I argree. And I don't understand that patch yet, it said:
>>
>> If the bitmap space has enough room, size the I/O for the last
>> bitmap
>> page write to the optimal I/O size for the storage device.
>>
>> Does this mean, for example, if bitmap space is 128k, while
>> there is
>> only one page, means 124k is not used. In this case, if device
>> opt io
>> size is 128k, this patch will choose to issue 128k IO instead
>> of just
>> 4k IO? And how can this improve performance ...
>
> It looks like it does as you mentioned above. Through the commit
> 8745faa95611 message, the io size(3584 bytes, 7 sectors) is
> smaller
> than 4K. Without the patch 8745faa95611, the io size is round
> up with
> bdev_logical_block_size(bdev). If we round up io size with
> PAGE_SIZE,
> can it fix the performance problem? Because bitmap space is
> 4K/64K/128K, if it doesn't affect performance only changing the
> round
> up value to PAGE_SIZE, it'll easy to fix this problem.
>
I'm afiraid that the perf will drop if rounding up io size to 4K
for devices
optimal I/O size smaller than 4K. IMO better version of
md_super_write to is
necessary to handle bitmap pages as Nigel said.
--
Su
> Best Regards
> Xiao
>
>> Thanks,
>> Kuai
>>
>>
next prev parent reply other threads:[~2025-03-03 15:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 15:32 md bitmap writes random memory over disks' bitmap sectors Nigel Croxon
2025-02-28 2:06 ` Yu Kuai
2025-02-28 7:46 ` Xiao Ni
2025-03-03 15:10 ` Su Yue [this message]
2025-03-04 1:06 ` Xiao Ni
2025-03-03 13:40 ` 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=o6yip2tw.fsf@damenly.org \
--to=l@damenly.org \
--cc=jonathan.derrick@linux.dev \
--cc=linux-raid@vger.kernel.org \
--cc=ncroxon@redhat.com \
--cc=song@kernel.org \
--cc=xni@redhat.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 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.