zfs icon indicating copy to clipboard operation
zfs copied to clipboard

abd_os: iovec-based scatter abd for userspace

Open robn opened this issue 1 year ago • 0 comments

Motivation and Context

The main motivator here is that I want to experiment with various ways of more efficiently moving memory around and avoiding copies. Both method and goals are different in kernel and userspace, and I'm finding that the shared implementation is more of a burden than a help. Much better to have separate, focused implementations.

Description

See commits. The summary is:

  • abd: remove unused ABD_FLAG_ZEROS flag
  • zio: don't use allocation canary in userspace, as it gets in the way of userspace memory debuggers (eg valgrind)
  • abd_os: rework to provide cleaner separation of commont and platform-specific parts, including creating a specific abd_is for userspace
  • abd_os: replace the userspace abd_os with a new one based on struct iovec.

As noted in the last commit message, the new userspace abd_os is relatively simple. It's perhaps the simplest thing that could work, and so useful as an example. It's also should be a good base for further development.

How Has This Been Tested?

Compiled on Linux 6.1.x and FreeBSD 14. Two main tests performed: zdb -b on a user pool, and a number of ztest runs on both. Everything seems fine in userspace.

I don't expect any difference on the in-kernel versions. I'll let the test suite decide if that's true.

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Performance enhancement (non-breaking change which improves efficiency)
  • [x] Code cleanup (non-breaking change which makes code smaller or more readable)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • [ ] Documentation (a change to man pages or other documentation)

Checklist:

  • [ ] My code follows the OpenZFS code style requirements.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the contributing document.
  • [ ] I have added tests to cover my changes.
  • [ ] I have run the ZFS Test Suite with this change applied.
  • [x] All commit messages are properly formatted and contain Signed-off-by.

robn avatar Jun 07 '24 11:06 robn