linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/9] iov_iter: kunit: Cleanup, abstraction and more tests
@ 2023-09-14 22:15 David Howells
  2023-09-14 22:15 ` [RFC PATCH 1/9] iov_iter: Fix some checkpatch complaints in kunit tests David Howells
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: David Howells @ 2023-09-14 22:15 UTC (permalink / raw)
  To: Al Viro, Linus Torvalds
  Cc: David Howells, Jens Axboe, Christoph Hellwig, Christian Brauner,
	David Laight, Matthew Wilcox, Brendan Higgins, David Gow,
	linux-fsdevel, linux-block, linux-mm, netdev, linux-kselftest,
	kunit-dev, linux-kernel

Hi Al, Linus,

These patches make some changes to the kunit tests previously added for
iov_iter testing, in particular adding support for testing UBUF/IOVEC
iterators:

 (1) Clean up a couple of checkpatch style complaints.

 (2) Consolidate some repeated bits of code into helper functions and use
     the same struct to represent straight offset/address ranges and
     partial page lists.

 (3) Add a function to set up a userspace VM, attach the VM to the kunit
     testing thread, create an anonymous file, stuff some pages into the
     file and map the file into the VM to act as a buffer that can be used
     with UBUF/IOVEC iterators.

     I map an anonymous file with pages attached rather than using MAP_ANON
     so that I can check the pages obtained from iov_iter_extract_pages()
     without worrying about them changing due to swap, migrate, etc..

     [?] Is this the best way to do things?  Mirroring execve, it requires
     a number of extra core symbols to be exported.  Should this be done in
     the core code?

 (4) Add tests for copying into and out of UBUF and IOVEC iterators.

 (5) Add tests for extracting pages from UBUF and IOVEC iterators.

 (6) Add tests to benchmark copying 256MiB to UBUF, IOVEC, KVEC, BVEC and
     XARRAY iterators.

     [!] Note that this requires 256MiB of memory for UBUF and IOVEC; the
     KVEC, BVEC and XARRAY benchmarking maps a single page multiple times.
     I might be able to shrink that if I can add the same page multiple
     times to the anon file's pagecache.  I'm sure this is not recommended,
     but I might be able to get away with it for this particular
     application.

 (7) Add a test to benchmark copying 256MiB through dynamically allocated
     256-page bvecs to simulate bio construction.

Example benchmarks output:

 iov_kunit_benchmark_ubuf: avg 26899 uS, stddev 142 uS
 iov_kunit_benchmark_iovec: avg 26897 uS, stddev 74 uS
 iov_kunit_benchmark_kvec: avg 2688 uS, stddev 35 uS
 iov_kunit_benchmark_bvec: avg 3139 uS, stddev 21 uS
 iov_kunit_benchmark_bvec_split: avg 3379 uS, stddev 15 uS
 iov_kunit_benchmark_xarray: avg 3582 uS, stddev 13 uS

I've pushed the patches here also:

	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=iov-kunit

David

David Howells (9):
  iov_iter: Fix some checkpatch complaints in kunit tests
  iov_iter: Consolidate some of the repeated code into helpers
  iov_iter: Consolidate the test vector struct in the kunit tests
  iov_iter: Consolidate bvec pattern checking
  iov_iter: Create a function to prepare userspace VM for UBUF/IOVEC
    tests
  iov_iter: Add copy kunit tests for ITER_UBUF and ITER_IOVEC
  iov_iter: Add extract kunit tests for ITER_UBUF and ITER_IOVEC
  iov_iter: Add benchmarking kunit tests
  iov_iter: Add benchmarking kunit tests for UBUF/IOVEC

 fs/anon_inodes.c     |    1 +
 kernel/fork.c        |    2 +
 lib/kunit_iov_iter.c | 1211 +++++++++++++++++++++++++++++++++++-------
 mm/mmap.c            |    1 +
 mm/util.c            |    1 +
 5 files changed, 1024 insertions(+), 192 deletions(-)



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-09-15 13:25 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-14 22:15 [RFC PATCH 0/9] iov_iter: kunit: Cleanup, abstraction and more tests David Howells
2023-09-14 22:15 ` [RFC PATCH 1/9] iov_iter: Fix some checkpatch complaints in kunit tests David Howells
2023-09-14 22:15 ` [RFC PATCH 2/9] iov_iter: Consolidate some of the repeated code into helpers David Howells
2023-09-14 22:15 ` [RFC PATCH 3/9] iov_iter: Consolidate the test vector struct in the kunit tests David Howells
2023-09-14 22:15 ` [RFC PATCH 4/9] iov_iter: Consolidate bvec pattern checking David Howells
2023-09-14 22:15 ` [RFC PATCH 5/9] iov_iter: Create a function to prepare userspace VM for UBUF/IOVEC tests David Howells
2023-09-14 22:15 ` [RFC PATCH 6/9] iov_iter: Add copy kunit tests for ITER_UBUF and ITER_IOVEC David Howells
2023-09-14 22:15 ` [RFC PATCH 7/9] iov_iter: Add extract " David Howells
2023-09-14 22:15 ` [RFC PATCH 8/9] iov_iter: Add benchmarking kunit tests David Howells
2023-09-14 22:15 ` [RFC PATCH 9/9] iov_iter: Add benchmarking kunit tests for UBUF/IOVEC David Howells
2023-09-15  7:09   ` David Laight
2023-09-15 10:10   ` David Howells
2023-09-15 10:51     ` David Laight
2023-09-15 11:23     ` David Howells
2023-09-15 12:10       ` David Laight
2023-09-15 12:36       ` David Howells
2023-09-15 13:08         ` David Laight
2023-09-15 13:24     ` David Howells
2023-09-15 12:19   ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).