freebsd-src/sys/geom
Mateusz Piotrowski d01183fddf
Some checks are pending
Cross-build Kernel / amd64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / amd64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / amd64 macos-latest (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 macos-latest (clang-18) (push) Waiting to run
geom/zero: Add support for unmapped I/O
This patch adds support for unmapped I/O to gzero(4).

Let's consider the following script to illustrate the change in
gzero(4)'s behavior:

```
dd="dd if=/dev/gzero of=/dev/null bs=512 count=100000"
dtrace -q -c "$dd" -n '
    fbt::pmap_qenter:entry,
    fbt::uiomove_fromphys:entry,
    fbt::memset:entry
    /execname == "dd"/
    {
	@[probefunc] = count();
    }
'
```

Let's run that script 4 times:

```
==> 1: unmapped I/O not supported (fallback to mapped I/O), kern.geom.zero.clear=1
51200000 bytes transferred in 1.795809 secs (28510829 bytes/sec)
  pmap_qenter                                                  100000
  memset                                                       400011

==> 2: unmapped I/O not supported (fallback to mapped I/O), kern.geom.zero.clear=0
51200000 bytes transferred in 0.701079 secs (73030337 bytes/sec)
  memset                                                       300011

==> 3: unmapped I/O supported, kern.geom.zero.clear=1
51200000 bytes transferred in 0.771680 secs (66348750 bytes/sec)
  uiomove_fromphys                                             100000
  memset                                                       300011

==> 4: unmapped I/O supported, kern.geom.zero.clear=0
51200000 bytes transferred in 0.621303 secs (82407407 bytes/sec)
  memset                                                       300011
```

If kern.geom.zero.clear=0, then nothing really changes as no copying takes
place. Otherwise, we see by adding unmapped I/O support we avoid calls to
pmap_qenter(), which was called by GEOM to turn unmapped I/O requests into
mapped ones before passing them for processing to gzero(4).

Reviewed by:	bnovkov, markj
Approved by:	bnovkov (mentor), markj (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52998
2025-11-11 17:06:59 +01:00
..
cache call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
concat GEOM: remove the redundant if statement 2025-09-13 21:29:00 -06:00
eli call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
gate call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
journal call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
label call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
linux_lvm call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
mirror call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
mountver call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
multipath GEOM: remove the redundant if statement 2025-09-13 21:29:00 -06:00
nop call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
part g_part: Replace some spaces with tabs to match the rest of this struct 2025-10-08 19:41:23 -06:00
raid GEOM: remove the redundant if statement 2025-09-13 21:29:00 -06:00
raid3 call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
shsec call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
stripe call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
union gunion: Also destroy the rw_lock 2025-09-12 09:48:24 -06:00
uzip
virstor call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
zero geom/zero: Add support for unmapped I/O 2025-11-11 17:06:59 +01:00
geom.h GEOM: add a new function g_new_geom 2025-09-05 12:42:21 -06:00
geom_bsd_enc.c
geom_ccd.c sys/geom: use proper style for sizeof operator 2025-07-26 18:13:20 +03:00
geom_ctl.c machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
geom_ctl.h
geom_dbg.h
geom_dev.c exterror(9): add infra for bufs and bios 2025-11-04 06:11:12 +02:00
geom_disk.c exterror(9): add infra for bufs and bios 2025-11-04 06:11:12 +02:00
geom_disk.h
geom_dump.c machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
geom_event.c geom: only set TDP_GEOM for user threads 2025-09-09 05:51:08 +03:00
geom_flashmap.c geom_flashmap: Rename the kernel module 2024-10-29 15:11:12 +00:00
geom_flashmap.h
geom_int.h
geom_io.c sys/geom: use proper style for sizeof operator 2025-07-26 18:13:20 +03:00
geom_kern.c sysctl(9): Ease exporting struct sizes; Discourage doing that 2025-05-07 12:13:40 +02:00
geom_slice.c call g_new_geom instead for callers that pass regular string to g_new_geomf 2025-09-05 12:42:21 -06:00
geom_slice.h
geom_subr.c exterr: print exterr for struct buf and bio in ddb show commands 2025-11-05 00:55:20 +02:00
geom_vfs.c geom/geom_vfs.c: use EXTERROR_KE() in g_vfs_strategy for ENXIOs 2025-11-04 06:11:12 +02:00
geom_vfs.h
notes