The NetBSD Project

CVS log for src/sys/dev/raidframe/rf_paritymap.h

[BACK] Up to [cvs.NetBSD.org] / src / sys / dev / raidframe

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.2.102.1: download - view: text, markup, annotated - select for diffs
Wed Nov 4 23:22:32 2026 UTC (11 days, 8 hours ago) by perseant
Branches: perseant-exfatfs
Diff to: previous 1.2: preferred, colored; next MAIN 1.3: preferred, colored
Changes since revision 1.2: +3 -3 lines
Sync with HEAD

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sun Oct 18 01:39:05 2026 UTC (4 weeks, 1 day ago) by tls
Branches: MAIN
CVS tags: perseant-exfatfs-base-20261102, HEAD
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +3 -3 lines
Eliminate very low concurrency limit in RAIDframe, improving write throughput as much as 25%.

RAIDframe maintains a per-set freelist of "emergency buffers" to ensure it can perform I/O
under heavy memory pressure.  The freelist size was 10, and each I/O request can require
up to 2 buffers in some recovery conditions, so raidPtr->openings was limited to RAIDOUTSTANDING,
which was set to 6 (this was a bug; it should have been 5).

There is no need at all for this limit for RAID 0 or RAID 1 sets; they do not buffer I/O in
the relevant way.  Eliminate the allocation entirely in this case; openings is set as the
configured queue length for the RAID set.

For parity RAID sets, we dynamically size two freelists of pre-allocated buffers and the
openings value so that we consume no more than 1% of system RAM per set:
	openings = MIN(maxQueueDepth, MAX(RAIDOUTSTANDING, (1% of physmem), bytes_per_opening))
	stripe buffers: 2 * openings
	I/O buffers: openings * max_stripes_per_bp * numCol

	RAIDOUTSTANDING (now used as a floor) remains 6.

Now we use the pre-allocated buffers first, resorting to malloc() only if we run out.

This can use about 2.8MB of additional memory on very small systems with parity RAID.  It saves
about 1.6MB if they are using mirroring or striping, which is more likely, e.g. a router with
mirrored root flash.  It can use a great deal more memory on systems that happen to already have
a great deal more memory - up to 1% of system RAM per parity RAID set, of course.

Double the RAID metadata pool high-water marks to accomodate additional concurrency; widen
the pending write counter in the in-core parity map (consuming a whopping 4KB) to accommodate
queue lengths > 127.  Fix a couple of buglets.

The punchline: sequential 128K write performance goes from 750MB/sec to 950MB/sec on a RAID1
set of NVMe SSDs (a 25% improvement!); random write performance on a RAID5 set of 4 virtio
disks (backed by a single SSD; host is a Mac Studio M3 Ultra) on an aarch64 QEMU VM goes from
2800tps to 3300tps and throughput increases from 25MB/sec to 31MB/sec (workload is untarring
src.tar.gz from tmpfs to FFS on the RAID1 set).

Revision 1.1.6.3: download - view: text, markup, annotated - select for diffs
Wed Aug 11 22:54:08 2010 UTC (16 years, 3 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.1.6.2: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.6.2: +2 -1 lines
sync with head.

Revision 1.1.4.1: download - view: text, markup, annotated - select for diffs
Fri Apr 30 14:43:47 2010 UTC (16 years, 6 months ago) by uebayasi
Branches: uebayasi-xip
Diff to: previous 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1: +1 -0 lines
Sync with HEAD.

Revision 1.2.4.2: download - view: text, markup, annotated - select for diffs
Wed Apr 21 00:27:51 2010 UTC (16 years, 7 months ago) by matt
Branches: matt-nb5-mips64
CVS tags: matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-k15
Diff to: previous 1.2.4.1: preferred, colored; branchpoint 1.2: preferred, colored; next MAIN 1.3: preferred, colored
Changes since revision 1.2.4.1: +125 -0 lines
sync to netbsd-5

Revision 1.2.4.1
Sun Mar 14 21:11:41 2010 UTC (16 years, 8 months ago) by matt
Branches: matt-nb5-mips64
FILE REMOVED
Changes since revision 1.2: +0 -126 lines
file rf_paritymap.h was added on branch matt-nb5-mips64 on 2010-04-21 00:27:51 +0000

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Mar 14 21:11:41 2010 UTC (16 years, 8 months ago) by jld
Branches: MAIN
CVS tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, uebayasi-xip-base1, tls-maxphys-base-20171202, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, thorpej-ifq-base, thorpej-ifq, thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-futex, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, thorpej-altq-separation-base, thorpej-altq-separation, rmind-uvmplock-nbase, rmind-uvmplock-base, rmind-uvmplock, rmind-smpnet-nbase, rmind-smpnet-base, rmind-smpnet, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, perseant-exfatfs-base-20250801, perseant-exfatfs-base-20240630, perseant-exfatfs-base, nick-nhusb-base-20170825, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base, nick-nhusb, netbsd-9-base, netbsd-9-5-RELEASE, netbsd-9-4-RELEASE, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-3-RELEASE, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, netbsd-11-base, netbsd-11-1-RELEASE, netbsd-11-0-RELEASE, netbsd-11-0-RC7, netbsd-11-0-RC6, netbsd-11-0-RC5, netbsd-11-0-RC4, netbsd-11-0-RC3, netbsd-11-0-RC2, netbsd-11-0-RC1, netbsd-11, netbsd-10-base, netbsd-10-2-RELEASE, netbsd-10-1-RELEASE, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, matt-nb8-mediatek-base, matt-nb8-mediatek, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, localcount-20160914, khorben-n900, jruoho-x86intr-base, jruoho-x86intr, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2, jmcneill-usbmp-base10, jmcneill-usbmp-base, jmcneill-usbmp, jmcneill-audiomp3-base, jmcneill-audiomp3, jdolecek-ncqfixes-base, jdolecek-ncqfixes, jdolecek-ncq-base, jdolecek-ncq, isaki-audio2-base, isaki-audio2, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, cherry-xenmp-base, cherry-xenmp, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh, bouyer-sunxi-drm-base, bouyer-sunxi-drm, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver, ad-namecache-base3, ad-namecache-base2, ad-namecache-base1, ad-namecache-base, ad-namecache
Branch point for: perseant-exfatfs, matt-nb5-mips64
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +2 -1 lines
For RAID sets which have no parity (i.e., RAID level 0) and therefore can
never have a parity map, make the parity map ioctls fail with EINVAL.

This makes `raidctl -m` print a scary-looking error on such sets, which
is an improvement over the previous behavior of falsely claiming that
the parity map would be enabled on the next configuration.

Revision 1.1.6.2: download - view: text, markup, annotated - select for diffs
Thu Mar 11 15:04:01 2010 UTC (16 years, 8 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.1.6.1: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.6.1: +125 -0 lines
sync with head

Revision 1.1.2.2: download - view: text, markup, annotated - select for diffs
Thu Dec 10 23:01:44 2009 UTC (16 years, 11 months ago) by snj
Branches: netbsd-5
CVS tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, matt-nb5-pq3-base, matt-nb5-pq3
Diff to: previous 1.1.2.1: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.2.1: +125 -0 lines
Pull up following revision(s) (requested by tron in ticket #1187):
	sys/dev/raidframe/rf_paritymap.c: revision 1.1-1.3 via patch
	sys/dev/raidframe/rf_paritymap.h: revision 1.1 via patch
Pull up the RAIDframe parity map Summer Of Code project.
Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes.  Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Revision 1.1.6.1
Tue Nov 17 18:54:26 2009 UTC (17 years ago) by yamt
Branches: yamt-nfs-mp
FILE REMOVED
Changes since revision 1.1: +0 -125 lines
file rf_paritymap.h was added on branch yamt-nfs-mp on 2010-03-11 15:04:01 +0000

Revision 1.1.2.1
Tue Nov 17 18:54:26 2009 UTC (17 years ago) by snj
Branches: netbsd-5
FILE REMOVED
Changes since revision 1.1: +0 -125 lines
file rf_paritymap.h was added on branch netbsd-5 on 2009-12-10 23:01:44 +0000

Revision 1.1: download - view: text, markup, annotated - select for diffs
Tue Nov 17 18:54:26 2009 UTC (17 years ago) by jld
Branches: MAIN
CVS tags: yamt-nfs-mp-base9, uebayasi-xip-base, matt-premerge-20091211
Branch point for: yamt-nfs-mp, uebayasi-xip, netbsd-5
Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes.  Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>