From patchwork Fri Feb 28 11:32:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 11412049 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94CA713A4 for ; Fri, 28 Feb 2020 11:35:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 53827246A8 for ; Fri, 28 Feb 2020 11:35:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IQb3ZBk1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53827246A8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8E6C26B0008; Fri, 28 Feb 2020 06:35:11 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8BDB86B000A; Fri, 28 Feb 2020 06:35:11 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75E446B000C; Fri, 28 Feb 2020 06:35:11 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 5EEEC6B0008 for ; Fri, 28 Feb 2020 06:35:11 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 27DE4180AD817 for ; Fri, 28 Feb 2020 11:35:11 +0000 (UTC) X-FDA: 76539329622.30.blood77_6769f0e91f004 X-Spam-Summary: 2,0,0,c43e56780cb0790e,d41d8cd98f00b204,kernelfans@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1431:1437:1535:1543:1711:1730:1747:1777:1792:1801:2393:2559:2562:3138:3139:3140:3141:3142:3354:3865:3867:3870:3871:4117:4321:4605:5007:6119:6261:6653:6742:7514:8603:8634:9413:10004:11026:11473:11657:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13846:14096:14181:14394:14687:14721:21080:21251:21444:21451:21627:21666:30054:30056:30064:30070,0,RBL:209.85.215.193:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: blood77_6769f0e91f004 X-Filterd-Recvd-Size: 6259 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 28 Feb 2020 11:35:10 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id d6so1380845pgn.5 for ; Fri, 28 Feb 2020 03:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ouTGWuIUR4ceNSkskbl9Csp7Y8Pui/2+vsjeiQPYtso=; b=IQb3ZBk1vuHvPHxRxGSKJCYTi8d30EqOzK2cHF2dZg+4pwg4qVI45YOAN+3U/mimRQ GAu6KBfoDzJhMJAZsOjhi1sj+qocX8+zCwiHI3UlNzB0BEu7FB0VIQxssualMf3nON+S FzjmVy498QDo9y2ei1T2ZRZhhYiHYEUzXKoY7DklI2j7uFgw2psu+hFQaHRkZ6WK2hWN jyeEamqcwPOpi7fTiZdt+iOGED7GWqk8YuWQeo+7bRU3R+4g96avicc2ZacjMD6vmKdL odfmN5kbK+1fvy1uNTYymPjRDNUU68fY2cFyIxwpN0z1NJPndEC0x7tKRRwtJmM+qpjH VyLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ouTGWuIUR4ceNSkskbl9Csp7Y8Pui/2+vsjeiQPYtso=; b=L/ERm8QshACRUZ9Op5T66pBReN3f04NhS2/HRHw/V5BDJ9Zt+acGHrInbnJnrJFuE3 MxvEBEgYv1B56oUuJcuGUQKSP3s8yFh7g7xoJ8GteyOPH6mOaW8ohGZunVRkPX2SMyG/ zwtNSrovsAXK4StG1GddZrsYjrGb9P3AB5vGj2jBcvijqPuU5aKi6P27YZy9kn6bEWq3 pzivWsBFTwleNq149O5eZ4s77uV+6L+LG4JEQuJj8y9NPLlKLj8vlFzR29b5PrkM4YXX JvBwhHGHFpj2MgKCbmH3Y62MgpmPn9JMV61+ClCpGdT+pwzZfx+qOJNxtSBjWXn/fEaL Qjxw== X-Gm-Message-State: APjAAAVBNPR6/cdY8dQXDq6jb34uKoVpLflu/9o23+IzBn2dgq9KBdSs l0FA0okSOt1on2ZQUW8E/JkLXPfGHA== X-Google-Smtp-Source: APXvYqwT4s9eUrkPHKnI8fgZNrAbSk5HCS7MHbN9UD+OioNjos79T6t0N5IxmNUiH9pBXZYSIbQvuA== X-Received: by 2002:a62:7d16:: with SMTP id y22mr3962132pfc.220.1582889709431; Fri, 28 Feb 2020 03:35:09 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id d14sm11402168pfq.117.2020.02.28.03.35.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Feb 2020 03:35:08 -0800 (PST) From: Pingfan Liu To: linux-mm@kvack.org Cc: Pingfan Liu , Ira Weiny , Andrew Morton , Mike Rapoport , Dan Williams , Matthew Wilcox , John Hubbard , "Aneesh Kumar K.V" , Keith Busch , Christoph Hellwig , Shuah Khan , linux-kernel@vger.kernel.org Subject: [PATCHv5 3/3] mm/gup_benchemark: add LONGTERM_BENCHMARK test in gup fast path Date: Fri, 28 Feb 2020 19:32:30 +0800 Message-Id: <1582889550-9101-4-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1582889550-9101-1-git-send-email-kernelfans@gmail.com> References: <1582889550-9101-1-git-send-email-kernelfans@gmail.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Introduce a GUP_LONGTERM_BENCHMARK ioctl to test longterm pin in gup fast path. Signed-off-by: Pingfan Liu Cc: Ira Weiny Cc: Andrew Morton Cc: Mike Rapoport Cc: Dan Williams Cc: Matthew Wilcox Cc: John Hubbard Cc: "Aneesh Kumar K.V" Cc: Keith Busch Cc: Christoph Hellwig Cc: Shuah Khan To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- 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; 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;