diff mbox series

[2/2] generic: add tests for read/writes from hugepages-backed buffers

Message ID 20241218210122.3809198-3-joannelkoong@gmail.com (mailing list archive)
State New
Headers show
Series fstests: test reads/writes from hugepages-backed buffers | expand

Commit Message

Joanne Koong Dec. 18, 2024, 9:01 p.m. UTC
Add generic tests 758 and 759 for testing reads/writes from buffers
backed by hugepages.

Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
---
 common/rc             | 10 ++++++++++
 tests/generic/758     | 23 +++++++++++++++++++++++
 tests/generic/758.out |  4 ++++
 tests/generic/759     | 24 ++++++++++++++++++++++++
 tests/generic/759.out |  4 ++++
 5 files changed, 65 insertions(+)
 create mode 100755 tests/generic/758
 create mode 100644 tests/generic/758.out
 create mode 100755 tests/generic/759
 create mode 100644 tests/generic/759.out

Comments

Darrick J. Wong Dec. 19, 2024, 5:52 p.m. UTC | #1
On Wed, Dec 18, 2024 at 01:01:22PM -0800, Joanne Koong wrote:
> Add generic tests 758 and 759 for testing reads/writes from buffers
> backed by hugepages.
> 
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> ---
>  common/rc             | 10 ++++++++++
>  tests/generic/758     | 23 +++++++++++++++++++++++
>  tests/generic/758.out |  4 ++++
>  tests/generic/759     | 24 ++++++++++++++++++++++++
>  tests/generic/759.out |  4 ++++
>  5 files changed, 65 insertions(+)
>  create mode 100755 tests/generic/758
>  create mode 100644 tests/generic/758.out
>  create mode 100755 tests/generic/759
>  create mode 100644 tests/generic/759.out
> 
> diff --git a/common/rc b/common/rc
> index 1b2e4508..33af7fa7 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3016,6 +3016,16 @@ _require_xfs_io_command()
>  	fi
>  }
>  
> +# check that the kernel and system supports huge pages
> +_require_thp()
> +{
> +    thp_status=$(cat /sys/kernel/mm/transparent_hugepage/enabled)
> +    if [[ $thp_status == *"[never]"* ]]; then
> +	    _notrun "system doesn't support transparent hugepages"
> +    fi
> +    _require_kernel_config CONFIG_TRANSPARENT_HUGEPAGE

Will /sys/kernel/mm/transparent_hugepage/ exist if
CONFIG_TRANSPARENT_HUGEPAGE=n ?

Or put another way, if /sys/kernel/mm/transparent_hugepage/ doesn't
exist, is that a sign that hugepages aren't enabled?

> +}
> +
>  # check that kernel and filesystem support direct I/O, and check if "$1" size
>  # aligned (optional) is supported
>  _require_odirect()
> diff --git a/tests/generic/758 b/tests/generic/758
> new file mode 100755
> index 00000000..b3bd6e5b
> --- /dev/null
> +++ b/tests/generic/758
> @@ -0,0 +1,23 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# FS QA Test No. 758
> +#
> +# fsx exercising reads/writes from userspace buffers
> +# backed by hugepages
> +#
> +. ./common/preamble
> +_begin_fstest rw auto quick
> +
> +# Import common functions.

No need for ^^ this comment.  Same with 759.

--D

> +. ./common/filter
> +
> +_require_test
> +_require_thp
> +
> +run_fsx -N 10000   	    -l 500000 -h
> +run_fsx -N 10000  -o 8192   -l 500000 -h
> +run_fsx -N 10000  -o 128000 -l 500000 -h
> +
> +status=0
> +exit
> diff --git a/tests/generic/758.out b/tests/generic/758.out
> new file mode 100644
> index 00000000..af04bb14
> --- /dev/null
> +++ b/tests/generic/758.out
> @@ -0,0 +1,4 @@
> +QA output created by 758
> +fsx -N 10000 -l 500000 -h
> +fsx -N 10000 -o 8192 -l 500000 -h
> +fsx -N 10000 -o 128000 -l 500000 -h
> diff --git a/tests/generic/759 b/tests/generic/759
> new file mode 100755
> index 00000000..6dfe2b86
> --- /dev/null
> +++ b/tests/generic/759
> @@ -0,0 +1,24 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# FS QA Test No. 759
> +#
> +# fsx exercising direct IO reads/writes from userspace buffers
> +# backed by hugepages
> +#
> +. ./common/preamble
> +_begin_fstest rw auto quick
> +
> +# Import common functions.
> +. ./common/filter
> +
> +_require_test
> +_require_odirect
> +_require_thp
> +
> +run_fsx -N 10000            -l 500000 -Z -R -W -h
> +run_fsx -N 10000  -o 8192   -l 500000 -Z -R -W -h
> +run_fsx -N 10000  -o 128000 -l 500000 -Z -R -W -h
> +
> +status=0
> +exit
> diff --git a/tests/generic/759.out b/tests/generic/759.out
> new file mode 100644
> index 00000000..18d21229
> --- /dev/null
> +++ b/tests/generic/759.out
> @@ -0,0 +1,4 @@
> +QA output created by 759
> +fsx -N 10000 -l 500000 -Z -R -W -h
> +fsx -N 10000 -o 8192 -l 500000 -Z -R -W -h
> +fsx -N 10000 -o 128000 -l 500000 -Z -R -W -h
> -- 
> 2.47.1
> 
>
Joanne Koong Dec. 19, 2024, 9:36 p.m. UTC | #2
On Thu, Dec 19, 2024 at 9:52 AM Darrick J. Wong <djwong@kernel.org> wrote:
>
> On Wed, Dec 18, 2024 at 01:01:22PM -0800, Joanne Koong wrote:
> > Add generic tests 758 and 759 for testing reads/writes from buffers
> > backed by hugepages.
> >
> > Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> > ---
> >  common/rc             | 10 ++++++++++
> >  tests/generic/758     | 23 +++++++++++++++++++++++
> >  tests/generic/758.out |  4 ++++
> >  tests/generic/759     | 24 ++++++++++++++++++++++++
> >  tests/generic/759.out |  4 ++++
> >  5 files changed, 65 insertions(+)
> >  create mode 100755 tests/generic/758
> >  create mode 100644 tests/generic/758.out
> >  create mode 100755 tests/generic/759
> >  create mode 100644 tests/generic/759.out
> >
> > diff --git a/common/rc b/common/rc
> > index 1b2e4508..33af7fa7 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -3016,6 +3016,16 @@ _require_xfs_io_command()
> >       fi
> >  }
> >
> > +# check that the kernel and system supports huge pages
> > +_require_thp()
> > +{
> > +    thp_status=$(cat /sys/kernel/mm/transparent_hugepage/enabled)
> > +    if [[ $thp_status == *"[never]"* ]]; then
> > +         _notrun "system doesn't support transparent hugepages"
> > +    fi
> > +    _require_kernel_config CONFIG_TRANSPARENT_HUGEPAGE
>
> Will /sys/kernel/mm/transparent_hugepage/ exist if
> CONFIG_TRANSPARENT_HUGEPAGE=n ?
>
> Or put another way, if /sys/kernel/mm/transparent_hugepage/ doesn't
> exist, is that a sign that hugepages aren't enabled?

I just checked the logic in hugepage_init() and it looks like the
sysfs initialization is gated by a has_transparent_hugepage() check
against that config, so no, ' /sys/kernel/mm/transparent_hugepage/'
won't be there if that config is set to n. Thanks for noting, I'll
revise this check.

>
> > +}
> > +
> >  # check that kernel and filesystem support direct I/O, and check if "$1" size
> >  # aligned (optional) is supported
> >  _require_odirect()
> > diff --git a/tests/generic/758 b/tests/generic/758
> > new file mode 100755
> > index 00000000..b3bd6e5b
> > --- /dev/null
> > +++ b/tests/generic/758
> > @@ -0,0 +1,23 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +#
> > +# FS QA Test No. 758
> > +#
> > +# fsx exercising reads/writes from userspace buffers
> > +# backed by hugepages
> > +#
> > +. ./common/preamble
> > +_begin_fstest rw auto quick
> > +
> > +# Import common functions.
>
> No need for ^^ this comment.  Same with 759.
>
> --D

Will remove these comments in v2.


Thanks,
Joanne

>
> > +. ./common/filter
> > +
> > +_require_test
> > +_require_thp
> > +
> > +run_fsx -N 10000         -l 500000 -h
> > +run_fsx -N 10000  -o 8192   -l 500000 -h
> > +run_fsx -N 10000  -o 128000 -l 500000 -h
> > +
> > +status=0
> > +exit
> > diff --git a/tests/generic/758.out b/tests/generic/758.out
> > new file mode 100644
> > index 00000000..af04bb14
> > --- /dev/null
> > +++ b/tests/generic/758.out
> > @@ -0,0 +1,4 @@
> > +QA output created by 758
> > +fsx -N 10000 -l 500000 -h
> > +fsx -N 10000 -o 8192 -l 500000 -h
> > +fsx -N 10000 -o 128000 -l 500000 -h
> > diff --git a/tests/generic/759 b/tests/generic/759
> > new file mode 100755
> > index 00000000..6dfe2b86
> > --- /dev/null
> > +++ b/tests/generic/759
> > @@ -0,0 +1,24 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +#
> > +# FS QA Test No. 759
> > +#
> > +# fsx exercising direct IO reads/writes from userspace buffers
> > +# backed by hugepages
> > +#
> > +. ./common/preamble
> > +_begin_fstest rw auto quick
> > +
> > +# Import common functions.
> > +. ./common/filter
> > +
> > +_require_test
> > +_require_odirect
> > +_require_thp
> > +
> > +run_fsx -N 10000            -l 500000 -Z -R -W -h
> > +run_fsx -N 10000  -o 8192   -l 500000 -Z -R -W -h
> > +run_fsx -N 10000  -o 128000 -l 500000 -Z -R -W -h
> > +
> > +status=0
> > +exit
> > diff --git a/tests/generic/759.out b/tests/generic/759.out
> > new file mode 100644
> > index 00000000..18d21229
> > --- /dev/null
> > +++ b/tests/generic/759.out
> > @@ -0,0 +1,4 @@
> > +QA output created by 759
> > +fsx -N 10000 -l 500000 -Z -R -W -h
> > +fsx -N 10000 -o 8192 -l 500000 -Z -R -W -h
> > +fsx -N 10000 -o 128000 -l 500000 -Z -R -W -h
> > --
> > 2.47.1
> >
> >
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 1b2e4508..33af7fa7 100644
--- a/common/rc
+++ b/common/rc
@@ -3016,6 +3016,16 @@  _require_xfs_io_command()
 	fi
 }
 
+# check that the kernel and system supports huge pages
+_require_thp()
+{
+    thp_status=$(cat /sys/kernel/mm/transparent_hugepage/enabled)
+    if [[ $thp_status == *"[never]"* ]]; then
+	    _notrun "system doesn't support transparent hugepages"
+    fi
+    _require_kernel_config CONFIG_TRANSPARENT_HUGEPAGE
+}
+
 # check that kernel and filesystem support direct I/O, and check if "$1" size
 # aligned (optional) is supported
 _require_odirect()
diff --git a/tests/generic/758 b/tests/generic/758
new file mode 100755
index 00000000..b3bd6e5b
--- /dev/null
+++ b/tests/generic/758
@@ -0,0 +1,23 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# FS QA Test No. 758
+#
+# fsx exercising reads/writes from userspace buffers
+# backed by hugepages
+#
+. ./common/preamble
+_begin_fstest rw auto quick
+
+# Import common functions.
+. ./common/filter
+
+_require_test
+_require_thp
+
+run_fsx -N 10000   	    -l 500000 -h
+run_fsx -N 10000  -o 8192   -l 500000 -h
+run_fsx -N 10000  -o 128000 -l 500000 -h
+
+status=0
+exit
diff --git a/tests/generic/758.out b/tests/generic/758.out
new file mode 100644
index 00000000..af04bb14
--- /dev/null
+++ b/tests/generic/758.out
@@ -0,0 +1,4 @@ 
+QA output created by 758
+fsx -N 10000 -l 500000 -h
+fsx -N 10000 -o 8192 -l 500000 -h
+fsx -N 10000 -o 128000 -l 500000 -h
diff --git a/tests/generic/759 b/tests/generic/759
new file mode 100755
index 00000000..6dfe2b86
--- /dev/null
+++ b/tests/generic/759
@@ -0,0 +1,24 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# FS QA Test No. 759
+#
+# fsx exercising direct IO reads/writes from userspace buffers
+# backed by hugepages
+#
+. ./common/preamble
+_begin_fstest rw auto quick
+
+# Import common functions.
+. ./common/filter
+
+_require_test
+_require_odirect
+_require_thp
+
+run_fsx -N 10000            -l 500000 -Z -R -W -h
+run_fsx -N 10000  -o 8192   -l 500000 -Z -R -W -h
+run_fsx -N 10000  -o 128000 -l 500000 -Z -R -W -h
+
+status=0
+exit
diff --git a/tests/generic/759.out b/tests/generic/759.out
new file mode 100644
index 00000000..18d21229
--- /dev/null
+++ b/tests/generic/759.out
@@ -0,0 +1,4 @@ 
+QA output created by 759
+fsx -N 10000 -l 500000 -Z -R -W -h
+fsx -N 10000 -o 8192 -l 500000 -Z -R -W -h
+fsx -N 10000 -o 128000 -l 500000 -Z -R -W -h