Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1471373
| Path | csiph.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.datemas.de!enother.net!enother.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Mike Rapoport <rppt@linux.vnet.ibm.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/3] userfaultfd: selftest: introduce userfaultfd_open |
| Date | Sun, 28 Aug 2016 16:40:01 +0200 |
| Message-ID | <sb9pD-2UB-7@gated-at.bofh.it> (permalink) |
| References | <sb9pD-2UB-3@gated-at.bofh.it> |
| X-Original-To | Andrea Arcangeli <aarcange@redhat.com> |
| X-Ibm-Helo | d06dlp03.portsmouth.uk.ibm.com |
| X-Ibm-Mailfrom | rppt@linux.vnet.ibm.com |
| X-Ibm-Rcptto | linux-kernel@vger.kernel.org |
| X-Mailer | git-send-email 1.9.1 |
| X-Tm-As-Mml | disable |
| X-Content-Scanned | Fidelis XPS MAILER |
| X-Cbid | 16082814-0040-0000-0000-000002C6EBB6 |
| X-Ibm-Av-Detection | SAVI=unused REMOTE=unused XFE=unused |
| X-Cbparentid | 16082814-0041-0000-0000-00001CBBC604 |
| X-Proofpoint-Virus-Version | vendor=fsecure engine=2.50.10432:,, definitions=2016-08-28_08:,, signatures=0 |
| X-Proofpoint-Spam-Details | rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608280143 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 75 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Pavel Emelyanov <xemul@virtuozzo.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport <rppt@linux.vnet.ibm.com> |
| X-Original-Date | Sun, 28 Aug 2016 17:37:45 +0300 |
| X-Original-Message-ID | <1472395067-24538-2-git-send-email-rppt@linux.vnet.ibm.com> |
| X-Original-References | <1472395067-24538-1-git-send-email-rppt@linux.vnet.ibm.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1471373 |
Show key headers only | View raw
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
tools/testing/selftests/vm/userfaultfd.c | 41 +++++++++++++++++++-------------
1 file changed, 25 insertions(+), 16 deletions(-)
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index a5e5808..75540e7 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -81,7 +81,7 @@ static int huge_fd;
static char *huge_fd_off0;
#endif
static unsigned long long *count_verify;
-static int uffd, finished, *pipefd;
+static int uffd, uffd_flags, finished, *pipefd;
static char *area_src, *area_dst;
static char *zeropage;
pthread_attr_t attr;
@@ -512,23 +512,9 @@ static int stress(unsigned long *userfaults)
return 0;
}
-static int userfaultfd_stress(void)
+static int userfaultfd_open(void)
{
- void *area;
- char *tmp_area;
- unsigned long nr;
- struct uffdio_register uffdio_register;
struct uffdio_api uffdio_api;
- unsigned long cpu;
- int uffd_flags, err;
- unsigned long userfaults[nr_cpus];
-
- allocate_area((void **)&area_src);
- if (!area_src)
- return 1;
- allocate_area((void **)&area_dst);
- if (!area_dst)
- return 1;
uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK);
if (uffd < 0) {
@@ -549,6 +535,29 @@ static int userfaultfd_stress(void)
return 1;
}
+ return 0;
+}
+
+static int userfaultfd_stress(void)
+{
+ void *area;
+ char *tmp_area;
+ unsigned long nr;
+ struct uffdio_register uffdio_register;
+ unsigned long cpu;
+ int err;
+ unsigned long userfaults[nr_cpus];
+
+ allocate_area((void **)&area_src);
+ if (!area_src)
+ return 1;
+ allocate_area((void **)&area_dst);
+ if (!area_dst)
+ return 1;
+
+ if (userfaultfd_open() < 0)
+ return 1;
+
count_verify = malloc(nr_pages * sizeof(unsigned long long));
if (!count_verify) {
perror("count_verify");
--
1.9.1
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 1/3] userfaultfd: selftest: introduce userfaultfd_open Mike Rapoport <rppt@linux.vnet.ibm.com> - 2016-08-28 16:40 +0200
csiph-web