Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2197811ybh; Sun, 15 Mar 2020 21:38:59 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvniXV5x/3tx3A+JPq+VH7pIwOavwo94kK4B/6EKM2j/NIVv2YSJFqigJlSqG5Sx/3sIqxg X-Received: by 2002:a05:6830:4a6:: with SMTP id l6mr22166977otd.61.1584333539796; Sun, 15 Mar 2020 21:38:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584333539; cv=none; d=google.com; s=arc-20160816; b=bmqJ4Favjgag09bWB0NODmo6v5JdlDrR1iR6vT+w51byiKaejztosY/inD6wQpKJ20 9lNCXJ/g58+WHTcrioHe7SFYgcsoB0OxVXnBSfeXaTMA0gY4Qp/dPKcGT/zKQZLZe/wu 4sAja+wuqFg1/WUFUmyfMv2pcrQ4hfj+bkMr1mCgmcKhAONo9cCyOicrDEl1Px1+KSUY 9U01fvGgLmxAO0keIaDDXe9nGB8d4RQgsKNm4FwxbelxoXwqCCXrkZh+MP9SrDj53x0h HIAlz/WlEJ7aU44wKmrGnGxm5aGkskAygdulxsarzxWSNo8Z7zM439IxzKEnUl/RxOG7 yWbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=x2aIrmW9cjK3AgpyGIiS7LfjEbJ0vHmekSq11XjW84U=; b=KnH97f4DplNwDcs/Dni1F4XhlNLJWXnXfoO7/NwmAWccxYcf22nJ2Xuf6KX284fLGT k20BkEtkyDjosy4JI0a4IW9HVmAkE9QfJfxY4iv9v+Iub2G8FH7cTj8J3RA2t1Bdudfz JGa411eDzxvJ6eDKQqaU2virlCJ+07/N/nkV+s12ir5uwWepbLrgzRFGDQ/+9zu9N+fG 79+6gY9oX/Uxf5fVE0DOf7BLsPP4vubXAIQMO4ubcXEF3JnooUJz4hHASEwz7chlzitj LdHbpfKQYtRpwiBJjxrGUwaqR5HvbXYktmRAS+czB5DQBj9yd/nDmsGoa6Ntyqc0SfEP X7Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uHezxfB6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 194si9316527oii.2.2020.03.15.21.38.46; Sun, 15 Mar 2020 21:38:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uHezxfB6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729709AbgCPEgn (ORCPT + 99 others); Mon, 16 Mar 2020 00:36:43 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40449 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729423AbgCPEgn (ORCPT ); Mon, 16 Mar 2020 00:36:43 -0400 Received: by mail-pg1-f196.google.com with SMTP id t24so8990703pgj.7 for ; Sun, 15 Mar 2020 21:36:42 -0700 (PDT) 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=x2aIrmW9cjK3AgpyGIiS7LfjEbJ0vHmekSq11XjW84U=; b=uHezxfB6KVcV9YYBFik9200F1Q4y/ehcQzB5jf54vlptqSWdZ3jJLn4xNpPBYgwIlK vmSD8ooYCjlXZloxDZHYtzylV1gGJ7By8PpRCjRyUT4PNvfQMXKI6Tgv2pAYhFtIyGdV lfhXu66n8BEGPws4QUjrFyfabLS8vrI4UTvtS0Dpu5RYuZBWgFsN+tumWcL0cj9eMwP1 lQXV2zUL0UF78XXWQ8nqlc9Y9FAIN6u4gCw/N+4NGEi8kfcvzzU7BADywDAeRhFXu89d sKs8K0FFI9UeKscyTdBCyTIqN0HHULytKd8fplktKMe4unwI7B7lmFLOacuvBVqkPh4V rpNg== 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=x2aIrmW9cjK3AgpyGIiS7LfjEbJ0vHmekSq11XjW84U=; b=FZvF52uX4RkrbXko2gOVh4lEeaQDCnIN8rAuk/M5b9up7AhM8v6VYOtldqFfX9Gci0 nQR9J24Qtr7XdkO4oFm8FUasT0/9V4XVlywpRx/yM/2l0L/65d9C9oBM3ccKAdXXiEDZ qgRThYg+TbjdPKoKCX8BaRX61cp+BtZGm8GMommTb/01cuFGZiLd9YNSWC2pH5KHWb0x 11IC7/nmHt2RsArJMKITGbatMoqURXT7qMbeeZ0YA7z8zF8LiJGM5h2KIHdpUgxqmTac ZAcR48Y7OlEqQRanFNjDwBwyE4SLppWhXxaqlfz+6vBmehYOacGnGRAHArRzIHAR2Yx+ qvdA== X-Gm-Message-State: ANhLgQ0S0KMrmWTQz0cfUG197cD1KdZCiYAQC4Q18egdnZ3rZGsit3ht xHQhbRZXttSQp6IXO7yyaQ== X-Received: by 2002:a63:5859:: with SMTP id i25mr24389370pgm.74.1584333402141; Sun, 15 Mar 2020 21:36:42 -0700 (PDT) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id d6sm18544296pjz.39.2020.03.15.21.36.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Mar 2020 21:36:41 -0700 (PDT) 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" , Christoph Hellwig , Shuah Khan , Alexander Duyck , linux-kernel@vger.kernel.org Subject: [PATCHv6 3/3] mm/gup_benchemark: add LONGTERM_BENCHMARK test in gup fast path Date: Mon, 16 Mar 2020 12:34:04 +0800 Message-Id: <1584333244-10480-4-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1584333244-10480-1-git-send-email-kernelfans@gmail.com> References: <1584333244-10480-1-git-send-email-kernelfans@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce a PIN_FAST_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: 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) 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; 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