Re: [PATCHv5 3/3] mm/gup_benchemark: add LONGTERM_BENCHMARK test in gup fast path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 28, 2020 at 3:35 AM Pingfan Liu <kernelfans@xxxxxxxxx> wrote:
>
> Introduce a GUP_LONGTERM_BENCHMARK ioctl to test longterm pin in gup fast
> path.

The title of the patch has a typo in it. There is only one 'e' in "benchmark".

> Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx>
> Cc: Ira Weiny <ira.weiny@xxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Mike Rapoport <rppt@xxxxxxxxxxxxx>
> Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> Cc: John Hubbard <jhubbard@xxxxxxxxxx>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxx>
> Cc: Keith Busch <keith.busch@xxxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Cc: Shuah Khan <shuah@xxxxxxxxxx>
> To: linux-mm@xxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> ---
>  mm/gup_benchmark.c                         | 7 +++++++
>  tools/testing/selftests/vm/gup_benchmark.c | 6 +++++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/mm/gup_benchmark.c b/mm/gup_benchmark.c
> index 8dba38e..bf61e7a 100644
> --- a/mm/gup_benchmark.c
> +++ b/mm/gup_benchmark.c
> @@ -8,6 +8,7 @@
>  #define GUP_FAST_BENCHMARK     _IOWR('g', 1, struct gup_benchmark)
>  #define GUP_LONGTERM_BENCHMARK _IOWR('g', 2, struct gup_benchmark)
>  #define GUP_BENCHMARK          _IOWR('g', 3, struct gup_benchmark)
> +#define GUP_FAST_LONGTERM_BENCHMARK    _IOWR('g', 4, struct gup_benchmark)
>
>  struct gup_benchmark {
>         __u64 get_delta_usec;
> @@ -57,6 +58,11 @@ static int __gup_benchmark_ioctl(unsigned int cmd,
>                         nr = get_user_pages_fast(addr, nr, gup->flags,
>                                                  pages + i);
>                         break;
> +               case GUP_FAST_LONGTERM_BENCHMARK:
> +                       nr = get_user_pages_fast(addr, nr,
> +                                       (gup->flags & 1) | FOLL_LONGTERM,
> +                                        pages + i);
> +                       break;

If I am not mistaken the mask of gup->flags is redundant. It is
already masked by FOLL_WRITE several lines before this switch
statement.

>                 case GUP_LONGTERM_BENCHMARK:
>                         nr = get_user_pages(addr, nr,
>                                             gup->flags | FOLL_LONGTERM,
> @@ -103,6 +109,7 @@ static long gup_benchmark_ioctl(struct file *filep, unsigned int cmd,
>
>         switch (cmd) {
>         case GUP_FAST_BENCHMARK:
> +       case GUP_FAST_LONGTERM_BENCHMARK:
>         case GUP_LONGTERM_BENCHMARK:
>         case GUP_BENCHMARK:
>                 break;
> diff --git a/tools/testing/selftests/vm/gup_benchmark.c b/tools/testing/selftests/vm/gup_benchmark.c
> index 389327e..5a01c538 100644
> --- a/tools/testing/selftests/vm/gup_benchmark.c
> +++ b/tools/testing/selftests/vm/gup_benchmark.c
> @@ -17,6 +17,7 @@
>  #define GUP_FAST_BENCHMARK     _IOWR('g', 1, struct gup_benchmark)
>  #define GUP_LONGTERM_BENCHMARK _IOWR('g', 2, struct gup_benchmark)
>  #define GUP_BENCHMARK          _IOWR('g', 3, struct gup_benchmark)
> +#define GUP_FAST_LONGTERM_BENCHMARK    _IOWR('g', 4, struct gup_benchmark)
>
>  /* Just the flags we need, copied from mm.h: */
>  #define FOLL_WRITE     0x01    /* check pte is writable */
> @@ -40,7 +41,7 @@ int main(int argc, char **argv)
>         char *file = "/dev/zero";
>         char *p;
>
> -       while ((opt = getopt(argc, argv, "m:r:n:f:tTLUwSH")) != -1) {
> +       while ((opt = getopt(argc, argv, "m:r:n:f:tTlLUwSH")) != -1) {
>                 switch (opt) {
>                 case 'm':
>                         size = atoi(optarg) * MB;
> @@ -57,6 +58,9 @@ int main(int argc, char **argv)
>                 case 'T':
>                         thp = 0;
>                         break;
> +               case 'l':
> +                       cmd = GUP_FAST_LONGTERM_BENCHMARK;
> +                       break;
>                 case 'L':
>                         cmd = GUP_LONGTERM_BENCHMARK;
>                         break;
> --
> 2.7.5
>
>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux