From: Ira Weiny <ira.weiny@intel.com>
To: Pingfan Liu <kernelfans@gmail.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@linux.ibm.com>,
Dan Williams <dan.j.williams@intel.com>,
Matthew Wilcox <willy@infradead.org>,
John Hubbard <jhubbard@nvidia.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
Keith Busch <keith.busch@intel.com>,
Christoph Hellwig <hch@infradead.org>,
Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv4 3/3] mm/gup_benchemark: add LONGTERM_BENCHMARK test in gup fast path
Date: Thu, 13 Jun 2019 14:42:47 -0700 [thread overview]
Message-ID: <20190613214247.GF32404@iweiny-DESK2.sc.intel.com> (raw)
In-Reply-To: <1560422702-11403-4-git-send-email-kernelfans@gmail.com>
On Thu, Jun 13, 2019 at 06:45:02PM +0800, Pingfan Liu wrote:
> Introduce a GUP_LONGTERM_BENCHMARK ioctl to test longterm pin in gup fast
> path.
>
> Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Mike Rapoport <rppt@linux.ibm.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
> Cc: Keith Busch <keith.busch@intel.com>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: linux-kernel@vger.kernel.org
> ---
> mm/gup_benchmark.c | 11 +++++++++--
> tools/testing/selftests/vm/gup_benchmark.c | 10 +++++++---
> 2 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/mm/gup_benchmark.c b/mm/gup_benchmark.c
> index 7dd602d..83f3378 100644
> --- a/mm/gup_benchmark.c
> +++ b/mm/gup_benchmark.c
> @@ -6,8 +6,9 @@
> #include <linux/debugfs.h>
>
> #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', 2, struct gup_benchmark)
> +#define GUP_LONGTERM_BENCHMARK _IOWR('g', 3, struct gup_benchmark)
> +#define GUP_BENCHMARK _IOWR('g', 4, struct gup_benchmark)
But I really like this addition! Thanks!
But why not just add GUP_FAST_LONGTERM_BENCHMARK to the end of this list (value
4)? I know the user space test program is probably expected to be lock step
with this code but it seems odd to redefine GUP_LONGTERM_BENCHMARK and
GUP_BENCHMARK with this change.
Ira
>
> struct gup_benchmark {
> __u64 get_delta_usec;
> @@ -53,6 +54,11 @@ static int __gup_benchmark_ioctl(unsigned int cmd,
> nr = get_user_pages_fast(addr, nr, gup->flags & 1,
> pages + i);
> break;
> + case GUP_FAST_LONGTERM_BENCHMARK:
> + nr = get_user_pages_fast(addr, nr,
> + (gup->flags & 1) | FOLL_LONGTERM,
> + pages + i);
> + break;
> case GUP_LONGTERM_BENCHMARK:
> nr = get_user_pages(addr, nr,
> (gup->flags & 1) | FOLL_LONGTERM,
> @@ -96,6 +102,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 c0534e2..ade8acb 100644
> --- a/tools/testing/selftests/vm/gup_benchmark.c
> +++ b/tools/testing/selftests/vm/gup_benchmark.c
> @@ -15,8 +15,9 @@
> #define PAGE_SIZE sysconf(_SC_PAGESIZE)
>
> #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', 2, struct gup_benchmark)
> +#define GUP_LONGTERM_BENCHMARK _IOWR('g', 3, struct gup_benchmark)
> +#define GUP_BENCHMARK _IOWR('g', 4, struct gup_benchmark)
>
> struct gup_benchmark {
> __u64 get_delta_usec;
> @@ -37,7 +38,7 @@ int main(int argc, char **argv)
> char *file = "/dev/zero";
> char *p;
>
> - while ((opt = getopt(argc, argv, "m:r:n:f:tTLUSH")) != -1) {
> + while ((opt = getopt(argc, argv, "m:r:n:f:tTlLUSH")) != -1) {
> switch (opt) {
> case 'm':
> size = atoi(optarg) * MB;
> @@ -54,6 +55,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
>
next prev parent reply other threads:[~2019-06-13 21:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 10:44 [PATCHv4 0/3] mm/gup: fix omission of check on FOLL_LONGTERM in gup fast path Pingfan Liu
2019-06-13 10:45 ` [PATCHv4 1/3] mm/gup: rename nr as nr_pinned in get_user_pages_fast() Pingfan Liu
2019-06-13 21:28 ` Ira Weiny
2019-06-13 10:45 ` [PATCHv4 2/3] mm/gup: fix omission of check on FOLL_LONGTERM in gup fast path Pingfan Liu
2019-06-13 21:39 ` Ira Weiny
2019-06-14 15:24 ` Pingfan Liu
2019-06-13 10:45 ` [PATCHv4 3/3] mm/gup_benchemark: add LONGTERM_BENCHMARK test " Pingfan Liu
2019-06-13 21:42 ` Ira Weiny [this message]
2019-06-13 21:49 ` Ira Weiny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190613214247.GF32404@iweiny-DESK2.sc.intel.com \
--to=ira.weiny@intel.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=hch@infradead.org \
--cc=jhubbard@nvidia.com \
--cc=keith.busch@intel.com \
--cc=kernelfans@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).