From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0317C46477 for ; Thu, 13 Jun 2019 21:41:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8FC5921721 for ; Thu, 13 Jun 2019 21:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727093AbfFMVl1 (ORCPT ); Thu, 13 Jun 2019 17:41:27 -0400 Received: from mga05.intel.com ([192.55.52.43]:59455 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbfFMVl0 (ORCPT ); Thu, 13 Jun 2019 17:41:26 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2019 14:41:25 -0700 X-ExtLoop1: 1 Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by fmsmga001.fm.intel.com with ESMTP; 13 Jun 2019 14:41:25 -0700 Date: Thu, 13 Jun 2019 14:42:47 -0700 From: Ira Weiny To: Pingfan Liu Cc: linux-mm@kvack.org, 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: Re: [PATCHv4 3/3] mm/gup_benchemark: add LONGTERM_BENCHMARK test in gup fast path Message-ID: <20190613214247.GF32404@iweiny-DESK2.sc.intel.com> References: <1560422702-11403-1-git-send-email-kernelfans@gmail.com> <1560422702-11403-4-git-send-email-kernelfans@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1560422702-11403-4-git-send-email-kernelfans@gmail.com> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > 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 > 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 > > #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 >