aboutsummaryrefslogtreecommitdiffstats
path: root/mm/gup_benchmark.c
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2018-10-26 18:09:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-26 19:38:15 -0400
commit26db3d09d9e1963c9db77cb275bd2d36e56ef57a (patch)
tree64343b6d275974aca5c2f8487ebf7d216edf45b4 /mm/gup_benchmark.c
parent7a1adfddaf0d11a39fdcaf6e82a88e9c0586e08b (diff)
mm/gup_benchmark.c: time put_page()
We'd like to measure time to unpin user pages, so this adds a second benchmark timer on put_page, separate from get_page. Adding the field breaks this ioctl ABI, but should be okay since this an in-tree kernel selftest. [akpm@linux-foundation.org: add expansion to struct gup_benchmark for future use] Link: http://lkml.kernel.org/r/20181010195605.10689-1-keith.busch@intel.com Signed-off-by: Keith Busch <keith.busch@intel.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/gup_benchmark.c')
-rw-r--r--mm/gup_benchmark.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mm/gup_benchmark.c b/mm/gup_benchmark.c
index 7405c9d89d65..e6aff102373b 100644
--- a/mm/gup_benchmark.c
+++ b/mm/gup_benchmark.c
@@ -8,11 +8,13 @@
8#define GUP_FAST_BENCHMARK _IOWR('g', 1, struct gup_benchmark) 8#define GUP_FAST_BENCHMARK _IOWR('g', 1, struct gup_benchmark)
9 9
10struct gup_benchmark { 10struct gup_benchmark {
11 __u64 delta_usec; 11 __u64 get_delta_usec;
12 __u64 put_delta_usec;
12 __u64 addr; 13 __u64 addr;
13 __u64 size; 14 __u64 size;
14 __u32 nr_pages_per_call; 15 __u32 nr_pages_per_call;
15 __u32 flags; 16 __u32 flags;
17 __u64 expansion[10]; /* For future use */
16}; 18};
17 19
18static int __gup_benchmark_ioctl(unsigned int cmd, 20static int __gup_benchmark_ioctl(unsigned int cmd,
@@ -48,14 +50,17 @@ static int __gup_benchmark_ioctl(unsigned int cmd,
48 } 50 }
49 end_time = ktime_get(); 51 end_time = ktime_get();
50 52
51 gup->delta_usec = ktime_us_delta(end_time, start_time); 53 gup->get_delta_usec = ktime_us_delta(end_time, start_time);
52 gup->size = addr - gup->addr; 54 gup->size = addr - gup->addr;
53 55
56 start_time = ktime_get();
54 for (i = 0; i < nr_pages; i++) { 57 for (i = 0; i < nr_pages; i++) {
55 if (!pages[i]) 58 if (!pages[i])
56 break; 59 break;
57 put_page(pages[i]); 60 put_page(pages[i]);
58 } 61 }
62 end_time = ktime_get();
63 gup->put_delta_usec = ktime_us_delta(end_time, start_time);
59 64
60 kvfree(pages); 65 kvfree(pages);
61 return 0; 66 return 0;