[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250829080426.1441678-1-yukuai1@huaweicloud.com>
Date: Fri, 29 Aug 2025 16:04:15 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: hch@...radead.org,
xni@...hat.com,
colyli@...nel.org,
linan122@...wei.com,
corbet@....net,
agk@...hat.com,
snitzer@...nel.org,
mpatocka@...hat.com,
song@...nel.org,
yukuai3@...wei.com,
hare@...e.de
Cc: linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
dm-devel@...ts.linux.dev,
linux-raid@...r.kernel.org,
yukuai1@...weicloud.com,
yi.zhang@...wei.com,
yangerkun@...wei.com,
johnny.chenyi@...wei.com,
hailan@...uai.org.cn
Subject: [PATCH v7 md-6.18 00/11] md/llbitmap: md/md-llbitmap: introduce a new lockless bitmap
From: Yu Kuai <yukuai3@...wei.com>
Changes from v6:
- fix special case in degraded mode in patch 11, also add description
about this case;
- fix some typos in patch 11;
Changes from v5:
- fix wrong place to check is blocks are synced in patch 8; (Xiao)
- raid5 is using recover to build initial xor data, fix that unexpected
resync is triggered, patch 9 and patch 11; (Myself by test)
- flush bitmap after it's initialized the first time, patch 11; (Xiao)
- some coding style, patch 11; (Xiao)
Changes from v4:
- fix dm-raid regerssion in patch 6, skip creating bitmap attributes
under mddev gendisk which is NULL;
- some minor cleanups and error handling fixes in patch 11;
- add review tag:
- patch 1-10 from Li Nan
- patch 4,5,6,8 from Xiao
- patch 6 from Hannes
Changes from v3:
- fix redundant setting mddev->bitmap_id in patch 6;
- add explanation of bitmap attributes in Documentation;
- add llbitmap/barrier_idle in patch 11;
- add some comments in patch 11;
Changes from v2:
- add comments about KOBJECT_CHANGE uevent in patch 6;
- convert llbitmap_suspend() to llbitmap_suspend_timeout() in patch 11;
- add some comments in patch 11;
- add review tag:
- patch 3,4,5,9 from Hannes
Changes from v1:
- explain md_bitmap_fn in commit message, patch 3;
- handle the case CONFIG_MD_BITMAP is disabled, patch 4;
- split patch 7 from v1 into patch 5 + 6;
- rewrite bitmap_type_store, patch 5;
- fix dm-raid regerssion that md-bitmap sysfs entries should not be
created under mddev kobject, patch 6
- merge llbitmap patches into one patch, with lots of cleanups;
- add review tag:
- patch 1,2,7,8,9,10 from Christoph
- patch 1,2,7,8,10 from Hannes
- patch 1,2,3,7 from Xiao
v4: https://lore.kernel.org/all/20250721171557.34587-1-yukuai@kernel.org/
v3: https://lore.kernel.org/linux-raid/20250718092336.3346644-1-yukuai1@huaweicloud.com/
v2: https://lore.kernel.org/all/20250707165202.11073-12-yukuai@kernel.org/
v1: https://lore.kernel.org/all/20250524061320.370630-1-yukuai1@huaweicloud.com/
RFC: https://lore.kernel.org/all/20250512011927.2809400-1-yukuai1@huaweicloud.com/
Redundant data is used to enhance data fault tolerance, and the storage
method for redundant data vary depending on the RAID levels. And it's
important to maintain the consistency of redundant data.
Bitmap is used to record which data blocks have been synchronized and which
ones need to be resynchronized or recovered. Each bit in the bitmap
represents a segment of data in the array. When a bit is set, it indicates
that the multiple redundant copies of that data segment may not be
consistent. Data synchronization can be performed based on the bitmap after
power failure or readding a disk. If there is no bitmap, a full disk
synchronization is required.
Due to known performance issues with md-bitmap and the unreasonable
implementations:
- self-managed IO submitting like filemap_write_page();
- global spin_lock
I have decided not to continue optimizing based on the current bitmap
implementation, this new bitmap is invented without locking from IO fast
path and can be used with fast disks.
For designs and details, see patch 11;
Performance Test:
Simple fio randwrite test to build array with 20GB ramdisk in my VM:
| | none | bitmap | llbitmap |
| -------------------- | --------- | --------- | --------- |
| raid1 | 13.7MiB/s | 9696KiB/s | 19.5MiB/s |
| raid1(assume clean) | 19.5MiB/s | 11.9MiB/s | 19.5MiB/s |
| raid10 | 21.9MiB/s | 11.6MiB/s | 27.8MiB/s |
| raid10(assume clean) | 27.8MiB/s | 15.4MiB/s | 27.8MiB/s |
| raid5 | 14.0MiB/s | 11.6MiB/s | 12.9MiB/s |
| raid5(assume clean) | 17.8MiB/s | 13.4MiB/s | 13.9MiB/s |
For raid1/raid10 llbitmap can be better than none bitmap with background
initial resync, and it's the same as none bitmap without it.
Noted that llbitmap performance improvement for raid5 is not obvious,
this is due to raid5 has many other performance bottleneck, perf
results still shows that bitmap overhead will be much less.
Yu Kuai (11):
md: add a new parameter 'offset' to md_super_write()
md: factor out a helper raid_is_456()
md/md-bitmap: support discard for bitmap ops
md: add a new mddev field 'bitmap_id'
md/md-bitmap: add a new sysfs api bitmap_type
md/md-bitmap: delay registration of bitmap_ops until creating bitmap
md/md-bitmap: add a new method skip_sync_blocks() in bitmap_operations
md/md-bitmap: add a new method blocks_synced() in bitmap_operations
md: add a new recovery_flag MD_RECOVERY_LAZY_RECOVER
md/md-bitmap: make method bitmap_ops->daemon_work optional
md/md-llbitmap: introduce new lockless bitmap
Documentation/admin-guide/md.rst | 86 +-
drivers/md/Kconfig | 11 +
drivers/md/Makefile | 1 +
drivers/md/md-bitmap.c | 15 +-
drivers/md/md-bitmap.h | 45 +-
drivers/md/md-llbitmap.c | 1625 ++++++++++++++++++++++++++++++
drivers/md/md.c | 332 ++++--
drivers/md/md.h | 20 +-
drivers/md/raid5.c | 34 +-
9 files changed, 2046 insertions(+), 123 deletions(-)
create mode 100644 drivers/md/md-llbitmap.c
--
2.39.2
Powered by blists - more mailing lists