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.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 F35A7C4332B for ; Thu, 19 Mar 2020 22:27:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A2D1C20663 for ; Thu, 19 Mar 2020 22:27:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="jEOX9rQv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2D1C20663 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1CC586B0005; Thu, 19 Mar 2020 18:27:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 17C576B0006; Thu, 19 Mar 2020 18:27:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 092016B0007; Thu, 19 Mar 2020 18:27:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E3E6D6B0005 for ; Thu, 19 Mar 2020 18:27:32 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 97BC2180AD81A for ; Thu, 19 Mar 2020 22:27:32 +0000 (UTC) X-FDA: 76613549544.08.crowd67_7bfcf938a655c X-HE-Tag: crowd67_7bfcf938a655c X-Filterd-Recvd-Size: 7050 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Thu, 19 Mar 2020 22:27:31 +0000 (UTC) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 19 Mar 2020 15:27:17 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Thu, 19 Mar 2020 15:27:30 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Thu, 19 Mar 2020 15:27:30 -0700 Received: from [10.2.57.192] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 19 Mar 2020 22:27:30 +0000 Subject: Re: [PATCHv6 3/3] mm/gup_benchemark: add LONGTERM_BENCHMARK test in gup fast path To: Pingfan Liu , CC: Ira Weiny , Andrew Morton , Mike Rapoport , Dan Williams , Matthew Wilcox , Aneesh Kumar K.V , Christoph Hellwig , Shuah Khan , Alexander Duyck , References: <1584333244-10480-1-git-send-email-kernelfans@gmail.com> <1584333244-10480-4-git-send-email-kernelfans@gmail.com> X-Nvconfidentiality: public From: John Hubbard Message-ID: <8d748bfe-b2b0-bb56-fb2c-71de86183ba5@nvidia.com> Date: Thu, 19 Mar 2020 15:27:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <1584333244-10480-4-git-send-email-kernelfans@gmail.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1584656837; bh=nk91weBAtrayW3KmCmBLApmBl4qnGFFxyE60moFZzkI=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=jEOX9rQvhTmUAtPKwAbPETnOA+ceD/ECdTXRQABfWOl9junc6F7nUF46D8ojQzaLJ IYEWxk4B5ZEAkUW/52A+Is8gZf2T/0S5ImKW26RTfjGoy6TxYgwCKRUIjqnxOiEPfQ 9gnT65WCs8VJ07LaLjE87Gq8mOvW4hWl6kaSdSCV6+k8dUQ2wKWjjcNNHM6AsIf8jL VhHvJqPPxSO298ORXglHBGEtQhWADKu3N9BK7KFumKH6rxEU1P3JHjPMdLAjdLLnrp yt2U2wSkVzmAbwdWHs/Vc8IVK5Ut91o+4eAKCRwpMSQ3QRhrbX3BrcdV2cRxrnPr3f zYfdojoWv2DLw== 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: On 3/15/20 9:34 PM, Pingfan Liu wrote: > Introduce a PIN_FAST_LONGTERM_BENCHMARK ioctl to test longterm pin in gup fast > path. 1. The subject line still has "benchemark", which should be "benchmark". 2. What do you really want to test? More about the use case to be tested would help. Just another sentence. I wouldn't normally ask, but in this case the implementation is slightly scrambled, and I can't suggest how to fix it because there's no information in the commit log as to the use case, nor the motivation. Below... > > 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: Christoph Hellwig > Cc: Shuah Khan > Cc: Alexander Duyck > 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 be690fa..09fba20 100644 > --- a/mm/gup_benchmark.c > +++ b/mm/gup_benchmark.c > @@ -10,6 +10,7 @@ > #define GUP_BENCHMARK _IOWR('g', 3, struct gup_benchmark) > #define PIN_FAST_BENCHMARK _IOWR('g', 4, struct gup_benchmark) > #define PIN_BENCHMARK _IOWR('g', 5, struct gup_benchmark) > +#define PIN_FAST_LONGTERM_BENCHMARK _IOWR('g', 6, struct gup_benchmark) Use PIN_ prefixes for things that test pin_user_pages*(), and GUP_ prefixes for things that test get_user_pages*(). I can't really be sure which one you want to test, but these wrongly intermixed: here you are using PIN_ and get_user_pages*(). > > struct gup_benchmark { > __u64 get_delta_usec; > @@ -101,6 +102,11 @@ static int __gup_benchmark_ioctl(unsigned int cmd, > nr = get_user_pages_fast(addr, nr, gup->flags, > pages + i); > break; > + case PIN_FAST_LONGTERM_BENCHMARK: > + nr = get_user_pages_fast(addr, nr, > + gup->flags | FOLL_LONGTERM, > + pages + i); > + break; Probably, pin_user_pages_fast() is where you want to go here, not get_user_pages_fast(). See the guidance in Documentation/core-api/pin_user_pages.rst to help decide. thanks, -- John Hubbard NVIDIA > case GUP_LONGTERM_BENCHMARK: > nr = get_user_pages(addr, nr, > gup->flags | FOLL_LONGTERM, > @@ -166,6 +172,7 @@ static long gup_benchmark_ioctl(struct file *filep, unsigned int cmd, > case GUP_BENCHMARK: > case PIN_FAST_BENCHMARK: > case PIN_BENCHMARK: > + case PIN_FAST_LONGTERM_BENCHMARK: > break; > default: > return -EINVAL; > diff --git a/tools/testing/selftests/vm/gup_benchmark.c b/tools/testing/selftests/vm/gup_benchmark.c > index 43b4dfe..f024ff3 100644 > --- a/tools/testing/selftests/vm/gup_benchmark.c > +++ b/tools/testing/selftests/vm/gup_benchmark.c > @@ -21,6 +21,7 @@ > /* Similar to above, but use FOLL_PIN instead of FOLL_GET. */ > #define PIN_FAST_BENCHMARK _IOWR('g', 4, struct gup_benchmark) > #define PIN_BENCHMARK _IOWR('g', 5, struct gup_benchmark) > +#define PIN_FAST_LONGTERM_BENCHMARK _IOWR('g', 6, struct gup_benchmark) > > /* Just the flags we need, copied from mm.h: */ > #define FOLL_WRITE 0x01 /* check pte is writable */ > @@ -44,7 +45,7 @@ int main(int argc, char **argv) > char *file = "/dev/zero"; > char *p; > > - while ((opt = getopt(argc, argv, "m:r:n:f:abtTLUuwSH")) != -1) { > + while ((opt = getopt(argc, argv, "m:r:n:f:abtTlLUuwSH")) != -1) { > switch (opt) { > case 'a': > cmd = PIN_FAST_BENCHMARK; > @@ -67,6 +68,9 @@ int main(int argc, char **argv) > case 'T': > thp = 0; > break; > + case 'l': > + cmd = PIN_FAST_LONGTERM_BENCHMARK; > + break; > case 'L': > cmd = GUP_LONGTERM_BENCHMARK; > break; > -- > 2.7.5 >