linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: aarcange@redhat.com, akpm@linux-foundation.org,
	almasrymina@google.com, axelrasmussen@google.com,
	bgeffon@google.com, dgilbert@redhat.com, hughd@google.com,
	jglisse@redhat.com, joe@perches.com, kirill@shutemov.name,
	linux-mm@kvack.org, lokeshgidra@google.com,
	mike.kravetz@oracle.com, mm-commits@vger.kernel.org,
	oupton@google.com, peterx@redhat.com, rppt@linux.vnet.ibm.com,
	sfr@canb.auug.org.au, shli@fb.com, shuah@kernel.org,
	torvalds@linux-foundation.org, viro@zeniv.linux.org.uk,
	wangqing@vivo.com
Subject: [patch 034/192] userfaultfd/selftests: unify error handling
Date: Wed, 30 Jun 2021 18:48:55 -0700	[thread overview]
Message-ID: <20210701014855._Z9WTu8lZ%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210630184624.9ca1937310b0dd5ce66b30e7@linux-foundation.org>

From: Peter Xu <peterx@redhat.com>
Subject: userfaultfd/selftests: unify error handling

Introduce err()/_err() and replace all the different ways to fail the
program, mostly "fprintf" and "perror" with tons of exit() calls.  Always
stop the test program at any failure.

Link: https://lkml.kernel.org/r/20210412232753.1012412-6-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Axel Rasmussen <axelrasmussen@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Joe Perches <joe@perches.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Lokesh Gidra <lokeshgidra@google.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Oliver Upton <oupton@google.com>
Cc: Shaohua Li <shli@fb.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Wang Qing <wangqing@vivo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 tools/testing/selftests/vm/userfaultfd.c |  556 +++++++--------------
 1 file changed, 187 insertions(+), 369 deletions(-)

--- a/tools/testing/selftests/vm/userfaultfd.c~userfaultfd-selftests-unify-error-handling
+++ a/tools/testing/selftests/vm/userfaultfd.c
@@ -140,11 +140,18 @@ static void usage(void)
 	exit(1);
 }
 
-#define uffd_error(code, fmt, ...)                                             \
-	do {                                                                   \
-		fprintf(stderr, fmt, ##__VA_ARGS__);                           \
-		fprintf(stderr, ": %" PRId64 "\n", (int64_t)(code));           \
-		exit(1);                                                       \
+#define _err(fmt, ...)						\
+	do {							\
+		int ret = errno;				\
+		fprintf(stderr, "ERROR: " fmt, ##__VA_ARGS__);	\
+		fprintf(stderr, " (errno=%d, line=%d)\n",	\
+			ret, __LINE__);				\
+	} while (0)
+
+#define err(fmt, ...)				\
+	do {					\
+		_err(fmt, ##__VA_ARGS__);	\
+		exit(1);			\
 	} while (0)
 
 static void uffd_stats_reset(struct uffd_stats *uffd_stats,
@@ -193,44 +200,28 @@ static void uffd_stats_report(struct uff
 	printf("\n");
 }
 
-static int anon_release_pages(char *rel_area)
+static void anon_release_pages(char *rel_area)
 {
-	int ret = 0;
-
-	if (madvise(rel_area, nr_pages * page_size, MADV_DONTNEED)) {
-		perror("madvise");
-		ret = 1;
-	}
-
-	return ret;
+	if (madvise(rel_area, nr_pages * page_size, MADV_DONTNEED))
+		err("madvise(MADV_DONTNEED) failed");
 }
 
 static void anon_allocate_area(void **alloc_area)
 {
-	if (posix_memalign(alloc_area, page_size, nr_pages * page_size)) {
-		fprintf(stderr, "out of memory\n");
-		*alloc_area = NULL;
-	}
+	if (posix_memalign(alloc_area, page_size, nr_pages * page_size))
+		err("posix_memalign() failed");
 }
 
 static void noop_alias_mapping(__u64 *start, size_t len, unsigned long offset)
 {
 }
 
-/* HugeTLB memory */
-static int hugetlb_release_pages(char *rel_area)
+static void hugetlb_release_pages(char *rel_area)
 {
-	int ret = 0;
-
 	if (fallocate(huge_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
-				rel_area == huge_fd_off0 ? 0 :
-				nr_pages * page_size,
-				nr_pages * page_size)) {
-		perror("fallocate");
-		ret = 1;
-	}
-
-	return ret;
+		      rel_area == huge_fd_off0 ? 0 : nr_pages * page_size,
+		      nr_pages * page_size))
+		err("fallocate() failed");
 }
 
 static void hugetlb_allocate_area(void **alloc_area)
@@ -243,20 +234,16 @@ static void hugetlb_allocate_area(void *
 			   MAP_HUGETLB,
 			   huge_fd, *alloc_area == area_src ? 0 :
 			   nr_pages * page_size);
-	if (*alloc_area == MAP_FAILED) {
-		perror("mmap of hugetlbfs file failed");
-		goto fail;
-	}
+	if (*alloc_area == MAP_FAILED)
+		err("mmap of hugetlbfs file failed");
 
 	if (map_shared) {
 		area_alias = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE,
 				  MAP_SHARED | MAP_HUGETLB,
 				  huge_fd, *alloc_area == area_src ? 0 :
 				  nr_pages * page_size);
-		if (area_alias == MAP_FAILED) {
-			perror("mmap of hugetlb file alias failed");
-			goto fail_munmap;
-		}
+		if (area_alias == MAP_FAILED)
+			err("mmap of hugetlb file alias failed");
 	}
 
 	if (*alloc_area == area_src) {
@@ -267,16 +254,6 @@ static void hugetlb_allocate_area(void *
 	}
 	if (area_alias)
 		*alloc_area_alias = area_alias;
-
-	return;
-
-fail_munmap:
-	if (munmap(*alloc_area, nr_pages * page_size) < 0) {
-		perror("hugetlb munmap");
-		exit(1);
-	}
-fail:
-	*alloc_area = NULL;
 }
 
 static void hugetlb_alias_mapping(__u64 *start, size_t len, unsigned long offset)
@@ -292,33 +269,24 @@ static void hugetlb_alias_mapping(__u64
 	*start = (unsigned long) area_dst_alias + offset;
 }
 
-/* Shared memory */
-static int shmem_release_pages(char *rel_area)
+static void shmem_release_pages(char *rel_area)
 {
-	int ret = 0;
-
-	if (madvise(rel_area, nr_pages * page_size, MADV_REMOVE)) {
-		perror("madvise");
-		ret = 1;
-	}
-
-	return ret;
+	if (madvise(rel_area, nr_pages * page_size, MADV_REMOVE))
+		err("madvise(MADV_REMOVE) failed");
 }
 
 static void shmem_allocate_area(void **alloc_area)
 {
 	*alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE,
 			   MAP_ANONYMOUS | MAP_SHARED, -1, 0);
-	if (*alloc_area == MAP_FAILED) {
-		fprintf(stderr, "shared memory mmap failed\n");
-		*alloc_area = NULL;
-	}
+	if (*alloc_area == MAP_FAILED)
+		err("mmap of memfd failed");
 }
 
 struct uffd_test_ops {
 	unsigned long expected_ioctls;
 	void (*allocate_area)(void **alloc_area);
-	int (*release_pages)(char *rel_area);
+	void (*release_pages)(char *rel_area);
 	void (*alias_mapping)(__u64 *start, size_t len, unsigned long offset);
 };
 
@@ -373,11 +341,8 @@ static void wp_range(int ufd, __u64 star
 	/* Undo write-protect, do wakeup after that */
 	prms.mode = wp ? UFFDIO_WRITEPROTECT_MODE_WP : 0;
 
-	if (ioctl(ufd, UFFDIO_WRITEPROTECT, &prms)) {
-		fprintf(stderr, "clear WP failed for address 0x%" PRIx64 "\n",
-			(uint64_t)start);
-		exit(1);
-	}
+	if (ioctl(ufd, UFFDIO_WRITEPROTECT, &prms))
+		err("clear WP failed: address=0x%"PRIx64, (uint64_t)start);
 }
 
 static void continue_range(int ufd, __u64 start, __u64 len)
@@ -388,12 +353,9 @@ static void continue_range(int ufd, __u6
 	req.range.len = len;
 	req.mode = 0;
 
-	if (ioctl(ufd, UFFDIO_CONTINUE, &req)) {
-		fprintf(stderr,
-			"UFFDIO_CONTINUE failed for address 0x%" PRIx64 "\n",
-			(uint64_t)start);
-		exit(1);
-	}
+	if (ioctl(ufd, UFFDIO_CONTINUE, &req))
+		err("UFFDIO_CONTINUE failed for address 0x%" PRIx64,
+		    (uint64_t)start);
 }
 
 static void *locking_thread(void *arg)
@@ -412,10 +374,8 @@ static void *locking_thread(void *arg)
 			seed += cpu;
 		bzero(&rand, sizeof(rand));
 		bzero(&randstate, sizeof(randstate));
-		if (initstate_r(seed, randstate, sizeof(randstate), &rand)) {
-			fprintf(stderr, "srandom_r error\n");
-			exit(1);
-		}
+		if (initstate_r(seed, randstate, sizeof(randstate), &rand))
+			err("initstate_r failed");
 	} else {
 		page_nr = -bounces;
 		if (!(bounces & BOUNCE_RACINGFAULTS))
@@ -424,16 +384,12 @@ static void *locking_thread(void *arg)
 
 	while (!finished) {
 		if (bounces & BOUNCE_RANDOM) {
-			if (random_r(&rand, &rand_nr)) {
-				fprintf(stderr, "random_r 1 error\n");
-				exit(1);
-			}
+			if (random_r(&rand, &rand_nr))
+				err("random_r failed");
 			page_nr = rand_nr;
 			if (sizeof(page_nr) > sizeof(rand_nr)) {
-				if (random_r(&rand, &rand_nr)) {
-					fprintf(stderr, "random_r 2 error\n");
-					exit(1);
-				}
+				if (random_r(&rand, &rand_nr))
+					err("random_r failed");
 				page_nr |= (((unsigned long) rand_nr) << 16) <<
 					   16;
 			}
@@ -442,12 +398,9 @@ static void *locking_thread(void *arg)
 		page_nr %= nr_pages;
 		pthread_mutex_lock(area_mutex(area_dst, page_nr));
 		count = *area_count(area_dst, page_nr);
-		if (count != count_verify[page_nr]) {
-			fprintf(stderr,
-				"page_nr %lu memory corruption %Lu %Lu\n",
-				page_nr, count,
-				count_verify[page_nr]); exit(1);
-		}
+		if (count != count_verify[page_nr])
+			err("page_nr %lu memory corruption %llu %llu",
+			    page_nr, count, count_verify[page_nr]);
 		count++;
 		*area_count(area_dst, page_nr) = count_verify[page_nr] = count;
 		pthread_mutex_unlock(area_mutex(area_dst, page_nr));
@@ -464,22 +417,21 @@ static void retry_copy_page(int ufd, str
 				     offset);
 	if (ioctl(ufd, UFFDIO_COPY, uffdio_copy)) {
 		/* real retval in ufdio_copy.copy */
-		if (uffdio_copy->copy != -EEXIST) {
-			uffd_error(uffdio_copy->copy,
-				   "UFFDIO_COPY retry error");
-		}
-	} else
-		uffd_error(uffdio_copy->copy, "UFFDIO_COPY retry unexpected");
+		if (uffdio_copy->copy != -EEXIST)
+			err("UFFDIO_COPY retry error: %"PRId64,
+			    (int64_t)uffdio_copy->copy);
+	} else {
+		err("UFFDIO_COPY retry unexpected: %"PRId64,
+		    (int64_t)uffdio_copy->copy);
+	}
 }
 
 static int __copy_page(int ufd, unsigned long offset, bool retry)
 {
 	struct uffdio_copy uffdio_copy;
 
-	if (offset >= nr_pages * page_size) {
-		fprintf(stderr, "unexpected offset %lu\n", offset);
-		exit(1);
-	}
+	if (offset >= nr_pages * page_size)
+		err("unexpected offset %lu\n", offset);
 	uffdio_copy.dst = (unsigned long) area_dst + offset;
 	uffdio_copy.src = (unsigned long) area_src + offset;
 	uffdio_copy.len = page_size;
@@ -491,9 +443,10 @@ static int __copy_page(int ufd, unsigned
 	if (ioctl(ufd, UFFDIO_COPY, &uffdio_copy)) {
 		/* real retval in ufdio_copy.copy */
 		if (uffdio_copy.copy != -EEXIST)
-			uffd_error(uffdio_copy.copy, "UFFDIO_COPY error");
+			err("UFFDIO_COPY error: %"PRId64,
+			    (int64_t)uffdio_copy.copy);
 	} else if (uffdio_copy.copy != page_size) {
-		uffd_error(uffdio_copy.copy, "UFFDIO_COPY unexpected copy");
+		err("UFFDIO_COPY error: %"PRId64, (int64_t)uffdio_copy.copy);
 	} else {
 		if (test_uffdio_copy_eexist && retry) {
 			test_uffdio_copy_eexist = false;
@@ -522,11 +475,10 @@ static int uffd_read_msg(int ufd, struct
 		if (ret < 0) {
 			if (errno == EAGAIN)
 				return 1;
-			perror("blocking read error");
+			err("blocking read error");
 		} else {
-			fprintf(stderr, "short read\n");
+			err("short read");
 		}
-		exit(1);
 	}
 
 	return 0;
@@ -537,10 +489,8 @@ static void uffd_handle_page_fault(struc
 {
 	unsigned long offset;
 
-	if (msg->event != UFFD_EVENT_PAGEFAULT) {
-		fprintf(stderr, "unexpected msg event %u\n", msg->event);
-		exit(1);
-	}
+	if (msg->event != UFFD_EVENT_PAGEFAULT)
+		err("unexpected msg event %u", msg->event);
 
 	if (msg->arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WP) {
 		/* Write protect page faults */
@@ -571,10 +521,8 @@ static void uffd_handle_page_fault(struc
 		stats->minor_faults++;
 	} else {
 		/* Missing page faults */
-		if (msg->arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WRITE) {
-			fprintf(stderr, "unexpected write fault\n");
-			exit(1);
-		}
+		if (msg->arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WRITE)
+			err("unexpected write fault");
 
 		offset = (char *)(unsigned long)msg->arg.pagefault.address - area_dst;
 		offset &= ~(page_size-1);
@@ -601,32 +549,20 @@ static void *uffd_poll_thread(void *arg)
 
 	for (;;) {
 		ret = poll(pollfd, 2, -1);
-		if (!ret) {
-			fprintf(stderr, "poll error %d\n", ret);
-			exit(1);
-		}
-		if (ret < 0) {
-			perror("poll");
-			exit(1);
-		}
+		if (ret <= 0)
+			err("poll error: %d", ret);
 		if (pollfd[1].revents & POLLIN) {
-			if (read(pollfd[1].fd, &tmp_chr, 1) != 1) {
-				fprintf(stderr, "read pipefd error\n");
-				exit(1);
-			}
+			if (read(pollfd[1].fd, &tmp_chr, 1) != 1)
+				err("read pipefd error");
 			break;
 		}
-		if (!(pollfd[0].revents & POLLIN)) {
-			fprintf(stderr, "pollfd[0].revents %d\n",
-				pollfd[0].revents);
-			exit(1);
-		}
+		if (!(pollfd[0].revents & POLLIN))
+			err("pollfd[0].revents %d", pollfd[0].revents);
 		if (uffd_read_msg(uffd, &msg))
 			continue;
 		switch (msg.event) {
 		default:
-			fprintf(stderr, "unexpected msg event %u\n",
-				msg.event); exit(1);
+			err("unexpected msg event %u\n", msg.event);
 			break;
 		case UFFD_EVENT_PAGEFAULT:
 			uffd_handle_page_fault(&msg, stats);
@@ -640,10 +576,8 @@ static void *uffd_poll_thread(void *arg)
 			uffd_reg.range.start = msg.arg.remove.start;
 			uffd_reg.range.len = msg.arg.remove.end -
 				msg.arg.remove.start;
-			if (ioctl(uffd, UFFDIO_UNREGISTER, &uffd_reg.range)) {
-				fprintf(stderr, "remove failure\n");
-				exit(1);
-			}
+			if (ioctl(uffd, UFFDIO_UNREGISTER, &uffd_reg.range))
+				err("remove failure");
 			break;
 		case UFFD_EVENT_REMAP:
 			area_dst = (char *)(unsigned long)msg.arg.remap.to;
@@ -746,9 +680,7 @@ static int stress(struct uffd_stats *uff
 	 * UFFDIO_COPY without writing zero pages into area_dst
 	 * because the background threads already completed).
 	 */
-	if (uffd_test_ops->release_pages(area_src))
-		return 1;
-
+	uffd_test_ops->release_pages(area_src);
 
 	finished = 1;
 	for (cpu = 0; cpu < nr_cpus; cpu++)
@@ -758,10 +690,8 @@ static int stress(struct uffd_stats *uff
 	for (cpu = 0; cpu < nr_cpus; cpu++) {
 		char c;
 		if (bounces & BOUNCE_POLL) {
-			if (write(pipefd[cpu*2+1], &c, 1) != 1) {
-				fprintf(stderr, "pipefd write error\n");
-				return 1;
-			}
+			if (write(pipefd[cpu*2+1], &c, 1) != 1)
+				err("pipefd write error");
 			if (pthread_join(uffd_threads[cpu],
 					 (void *)&uffd_stats[cpu]))
 				return 1;
@@ -861,10 +791,8 @@ static int faulting_process(int signal_t
 		memset(&act, 0, sizeof(act));
 		act.sa_sigaction = sighndl;
 		act.sa_flags = SA_SIGINFO;
-		if (sigaction(SIGBUS, &act, 0)) {
-			perror("sigaction");
-			return 1;
-		}
+		if (sigaction(SIGBUS, &act, 0))
+			err("sigaction");
 		lastnr = (unsigned long)-1;
 	}
 
@@ -874,10 +802,8 @@ static int faulting_process(int signal_t
 
 		if (signal_test) {
 			if (sigsetjmp(*sigbuf, 1) != 0) {
-				if (steps == 1 && nr == lastnr) {
-					fprintf(stderr, "Signal repeated\n");
-					return 1;
-				}
+				if (steps == 1 && nr == lastnr)
+					err("Signal repeated");
 
 				lastnr = nr;
 				if (signal_test == 1) {
@@ -902,12 +828,9 @@ static int faulting_process(int signal_t
 		}
 
 		count = *area_count(area_dst, nr);
-		if (count != count_verify[nr]) {
-			fprintf(stderr,
-				"nr %lu memory corruption %Lu %Lu\n",
-				nr, count,
-				count_verify[nr]);
-	        }
+		if (count != count_verify[nr])
+			err("nr %lu memory corruption %llu %llu\n",
+			    nr, count, count_verify[nr]);
 		/*
 		 * Trigger write protection if there is by writing
 		 * the same value back.
@@ -923,18 +846,14 @@ static int faulting_process(int signal_t
 
 	area_dst = mremap(area_dst, nr_pages * page_size,  nr_pages * page_size,
 			  MREMAP_MAYMOVE | MREMAP_FIXED, area_src);
-	if (area_dst == MAP_FAILED) {
-		perror("mremap");
-		exit(1);
-	}
+	if (area_dst == MAP_FAILED)
+		err("mremap");
 
 	for (; nr < nr_pages; nr++) {
 		count = *area_count(area_dst, nr);
 		if (count != count_verify[nr]) {
-			fprintf(stderr,
-				"nr %lu memory corruption %Lu %Lu\n",
-				nr, count,
-				count_verify[nr]); exit(1);
+			err("nr %lu memory corruption %llu %llu\n",
+			    nr, count, count_verify[nr]);
 		}
 		/*
 		 * Trigger write protection if there is by writing
@@ -943,15 +862,11 @@ static int faulting_process(int signal_t
 		*area_count(area_dst, nr) = count;
 	}
 
-	if (uffd_test_ops->release_pages(area_dst))
-		return 1;
+	uffd_test_ops->release_pages(area_dst);
 
-	for (nr = 0; nr < nr_pages; nr++) {
-		if (my_bcmp(area_dst + nr * page_size, zeropage, page_size)) {
-			fprintf(stderr, "nr %lu is not zero\n", nr);
-			exit(1);
-		}
-	}
+	for (nr = 0; nr < nr_pages; nr++)
+		if (my_bcmp(area_dst + nr * page_size, zeropage, page_size))
+			err("nr %lu is not zero", nr);
 
 	return 0;
 }
@@ -964,13 +879,12 @@ static void retry_uffdio_zeropage(int uf
 				     uffdio_zeropage->range.len,
 				     offset);
 	if (ioctl(ufd, UFFDIO_ZEROPAGE, uffdio_zeropage)) {
-		if (uffdio_zeropage->zeropage != -EEXIST) {
-			uffd_error(uffdio_zeropage->zeropage,
-				   "UFFDIO_ZEROPAGE retry error");
-		}
+		if (uffdio_zeropage->zeropage != -EEXIST)
+			err("UFFDIO_ZEROPAGE error: %"PRId64,
+			    (int64_t)uffdio_zeropage->zeropage);
 	} else {
-		uffd_error(uffdio_zeropage->zeropage,
-			   "UFFDIO_ZEROPAGE retry unexpected");
+		err("UFFDIO_ZEROPAGE error: %"PRId64,
+		    (int64_t)uffdio_zeropage->zeropage);
 	}
 }
 
@@ -983,10 +897,8 @@ static int __uffdio_zeropage(int ufd, un
 
 	has_zeropage = uffd_test_ops->expected_ioctls & (1 << _UFFDIO_ZEROPAGE);
 
-	if (offset >= nr_pages * page_size) {
-		fprintf(stderr, "unexpected offset %lu\n", offset);
-		exit(1);
-	}
+	if (offset >= nr_pages * page_size)
+		err("unexpected offset %lu", offset);
 	uffdio_zeropage.range.start = (unsigned long) area_dst + offset;
 	uffdio_zeropage.range.len = page_size;
 	uffdio_zeropage.mode = 0;
@@ -994,14 +906,13 @@ static int __uffdio_zeropage(int ufd, un
 	res = uffdio_zeropage.zeropage;
 	if (ret) {
 		/* real retval in ufdio_zeropage.zeropage */
-		if (has_zeropage) {
-			uffd_error(res, "UFFDIO_ZEROPAGE %s",
-				   res == -EEXIST ? "-EEXIST" : "error");
-		} else if (res != -EINVAL)
-			uffd_error(res, "UFFDIO_ZEROPAGE not -EINVAL");
+		if (has_zeropage)
+			err("UFFDIO_ZEROPAGE error: %"PRId64, (int64_t)res);
+		else if (res != -EINVAL)
+			err("UFFDIO_ZEROPAGE not -EINVAL");
 	} else if (has_zeropage) {
 		if (res != page_size) {
-			uffd_error(res, "UFFDIO_ZEROPAGE unexpected");
+			err("UFFDIO_ZEROPAGE unexpected size");
 		} else {
 			if (test_uffdio_zeropage_eexist && retry) {
 				test_uffdio_zeropage_eexist = false;
@@ -1011,7 +922,7 @@ static int __uffdio_zeropage(int ufd, un
 			return 1;
 		}
 	} else
-		uffd_error(res, "UFFDIO_ZEROPAGE succeeded");
+		err("UFFDIO_ZEROPAGE succeeded");
 
 	return 0;
 }
@@ -1030,8 +941,7 @@ static int userfaultfd_zeropage_test(voi
 	printf("testing UFFDIO_ZEROPAGE: ");
 	fflush(stdout);
 
-	if (uffd_test_ops->release_pages(area_dst))
-		return 1;
+	uffd_test_ops->release_pages(area_dst);
 
 	if (userfaultfd_open(0))
 		return 1;
@@ -1040,25 +950,16 @@ static int userfaultfd_zeropage_test(voi
 	uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
 	if (test_uffdio_wp)
 		uffdio_register.mode |= UFFDIO_REGISTER_MODE_WP;
-	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register)) {
-		fprintf(stderr, "register failure\n");
-		exit(1);
-	}
+	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register))
+		err("register failure");
 
 	expected_ioctls = uffd_test_ops->expected_ioctls;
-	if ((uffdio_register.ioctls & expected_ioctls) !=
-	    expected_ioctls) {
-		fprintf(stderr,
-			"unexpected missing ioctl for anon memory\n");
-		exit(1);
-	}
+	if ((uffdio_register.ioctls & expected_ioctls) != expected_ioctls)
+		err("unexpected missing ioctl for anon memory");
 
-	if (uffdio_zeropage(uffd, 0)) {
-		if (my_bcmp(area_dst, zeropage, page_size)) {
-			fprintf(stderr, "zeropage is not zero\n");
-			exit(1);
-		}
-	}
+	if (uffdio_zeropage(uffd, 0))
+		if (my_bcmp(area_dst, zeropage, page_size))
+			err("zeropage is not zero");
 
 	close(uffd);
 	printf("done.\n");
@@ -1078,8 +979,7 @@ static int userfaultfd_events_test(void)
 	printf("testing events (fork, remap, remove): ");
 	fflush(stdout);
 
-	if (uffd_test_ops->release_pages(area_dst))
-		return 1;
+	uffd_test_ops->release_pages(area_dst);
 
 	features = UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP |
 		UFFD_FEATURE_EVENT_REMOVE;
@@ -1092,41 +992,28 @@ static int userfaultfd_events_test(void)
 	uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
 	if (test_uffdio_wp)
 		uffdio_register.mode |= UFFDIO_REGISTER_MODE_WP;
-	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register)) {
-		fprintf(stderr, "register failure\n");
-		exit(1);
-	}
+	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register))
+		err("register failure");
 
 	expected_ioctls = uffd_test_ops->expected_ioctls;
-	if ((uffdio_register.ioctls & expected_ioctls) != expected_ioctls) {
-		fprintf(stderr, "unexpected missing ioctl for anon memory\n");
-		exit(1);
-	}
+	if ((uffdio_register.ioctls & expected_ioctls) != expected_ioctls)
+		err("unexpected missing ioctl for anon memory");
 
-	if (pthread_create(&uffd_mon, &attr, uffd_poll_thread, &stats)) {
-		perror("uffd_poll_thread create");
-		exit(1);
-	}
+	if (pthread_create(&uffd_mon, &attr, uffd_poll_thread, &stats))
+		err("uffd_poll_thread create");
 
 	pid = fork();
-	if (pid < 0) {
-		perror("fork");
-		exit(1);
-	}
+	if (pid < 0)
+		err("fork");
 
 	if (!pid)
 		exit(faulting_process(0));
 
 	waitpid(pid, &err, 0);
-	if (err) {
-		fprintf(stderr, "faulting process failed\n");
-		exit(1);
-	}
-
-	if (write(pipefd[1], &c, sizeof(c)) != sizeof(c)) {
-		perror("pipe write");
-		exit(1);
-	}
+	if (err)
+		err("faulting process failed");
+	if (write(pipefd[1], &c, sizeof(c)) != sizeof(c))
+		err("pipe write");
 	if (pthread_join(uffd_mon, NULL))
 		return 1;
 
@@ -1151,8 +1038,7 @@ static int userfaultfd_sig_test(void)
 	printf("testing signal delivery: ");
 	fflush(stdout);
 
-	if (uffd_test_ops->release_pages(area_dst))
-		return 1;
+	uffd_test_ops->release_pages(area_dst);
 
 	features = UFFD_FEATURE_EVENT_FORK|UFFD_FEATURE_SIGBUS;
 	if (userfaultfd_open(features))
@@ -1164,57 +1050,41 @@ static int userfaultfd_sig_test(void)
 	uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
 	if (test_uffdio_wp)
 		uffdio_register.mode |= UFFDIO_REGISTER_MODE_WP;
-	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register)) {
-		fprintf(stderr, "register failure\n");
-		exit(1);
-	}
+	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register))
+		err("register failure");
 
 	expected_ioctls = uffd_test_ops->expected_ioctls;
-	if ((uffdio_register.ioctls & expected_ioctls) != expected_ioctls) {
-		fprintf(stderr, "unexpected missing ioctl for anon memory\n");
-		exit(1);
-	}
+	if ((uffdio_register.ioctls & expected_ioctls) != expected_ioctls)
+		err("unexpected missing ioctl for anon memory");
 
-	if (faulting_process(1)) {
-		fprintf(stderr, "faulting process failed\n");
-		exit(1);
-	}
+	if (faulting_process(1))
+		err("faulting process failed");
 
-	if (uffd_test_ops->release_pages(area_dst))
-		return 1;
+	uffd_test_ops->release_pages(area_dst);
 
-	if (pthread_create(&uffd_mon, &attr, uffd_poll_thread, &stats)) {
-		perror("uffd_poll_thread create");
-		exit(1);
-	}
+	if (pthread_create(&uffd_mon, &attr, uffd_poll_thread, &stats))
+		err("uffd_poll_thread create");
 
 	pid = fork();
-	if (pid < 0) {
-		perror("fork");
-		exit(1);
-	}
+	if (pid < 0)
+		err("fork");
 
 	if (!pid)
 		exit(faulting_process(2));
 
 	waitpid(pid, &err, 0);
-	if (err) {
-		fprintf(stderr, "faulting process failed\n");
-		exit(1);
-	}
-
-	if (write(pipefd[1], &c, sizeof(c)) != sizeof(c)) {
-		perror("pipe write");
-		exit(1);
-	}
+	if (err)
+		err("faulting process failed");
+	if (write(pipefd[1], &c, sizeof(c)) != sizeof(c))
+		err("pipe write");
 	if (pthread_join(uffd_mon, (void **)&userfaults))
 		return 1;
 
 	printf("done.\n");
 	if (userfaults)
-		fprintf(stderr, "Signal test failed, userfaults: %ld\n",
-			userfaults);
+		err("Signal test failed, userfaults: %ld", userfaults);
 	close(uffd);
+
 	return userfaults != 0;
 }
 
@@ -1236,8 +1106,7 @@ static int userfaultfd_minor_test(void)
 	printf("testing minor faults: ");
 	fflush(stdout);
 
-	if (uffd_test_ops->release_pages(area_dst))
-		return 1;
+	uffd_test_ops->release_pages(area_dst);
 
 	if (userfaultfd_open_ext(&features))
 		return 1;
@@ -1251,17 +1120,13 @@ static int userfaultfd_minor_test(void)
 	uffdio_register.range.start = (unsigned long)area_dst_alias;
 	uffdio_register.range.len = nr_pages * page_size;
 	uffdio_register.mode = UFFDIO_REGISTER_MODE_MINOR;
-	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register)) {
-		fprintf(stderr, "register failure\n");
-		exit(1);
-	}
+	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register))
+		err("register failure");
 
 	expected_ioctls = uffd_test_ops->expected_ioctls;
 	expected_ioctls |= 1 << _UFFDIO_CONTINUE;
-	if ((uffdio_register.ioctls & expected_ioctls) != expected_ioctls) {
-		fprintf(stderr, "unexpected missing ioctl(s)\n");
-		exit(1);
-	}
+	if ((uffdio_register.ioctls & expected_ioctls) != expected_ioctls)
+		err("unexpected missing ioctl(s)");
 
 	/*
 	 * After registering with UFFD, populate the non-UFFD-registered side of
@@ -1272,10 +1137,8 @@ static int userfaultfd_minor_test(void)
 		       page_size);
 	}
 
-	if (pthread_create(&uffd_mon, &attr, uffd_poll_thread, &stats)) {
-		perror("uffd_poll_thread create");
-		exit(1);
-	}
+	if (pthread_create(&uffd_mon, &attr, uffd_poll_thread, &stats))
+		err("uffd_poll_thread create");
 
 	/*
 	 * Read each of the pages back using the UFFD-registered mapping. We
@@ -1284,26 +1147,19 @@ static int userfaultfd_minor_test(void)
 	 * page's contents, and then issuing a CONTINUE ioctl.
 	 */
 
-	if (posix_memalign(&expected_page, page_size, page_size)) {
-		fprintf(stderr, "out of memory\n");
-		return 1;
-	}
+	if (posix_memalign(&expected_page, page_size, page_size))
+		err("out of memory");
 
 	for (p = 0; p < nr_pages; ++p) {
 		expected_byte = ~((uint8_t)(p % ((uint8_t)-1)));
 		memset(expected_page, expected_byte, page_size);
 		if (my_bcmp(expected_page, area_dst_alias + (p * page_size),
-			    page_size)) {
-			fprintf(stderr,
-				"unexpected page contents after minor fault\n");
-			exit(1);
-		}
+			    page_size))
+			err("unexpected page contents after minor fault");
 	}
 
-	if (write(pipefd[1], &c, sizeof(c)) != sizeof(c)) {
-		perror("pipe write");
-		exit(1);
-	}
+	if (write(pipefd[1], &c, sizeof(c)) != sizeof(c))
+		err("pipe write");
 	if (pthread_join(uffd_mon, NULL))
 		return 1;
 
@@ -1321,7 +1177,6 @@ static int userfaultfd_stress(void)
 	unsigned long nr;
 	struct uffdio_register uffdio_register;
 	unsigned long cpu;
-	int err;
 	struct uffd_stats uffd_stats[nr_cpus];
 
 	uffd_test_ops->allocate_area((void **)&area_src);
@@ -1366,10 +1221,8 @@ static int userfaultfd_stress(void)
 		}
 	}
 
-	if (posix_memalign(&area, page_size, page_size)) {
-		fprintf(stderr, "out of memory\n");
-		return 1;
-	}
+	if (posix_memalign(&area, page_size, page_size))
+		err("out of memory");
 	zeropage = area;
 	bzero(zeropage, page_size);
 
@@ -1378,7 +1231,6 @@ static int userfaultfd_stress(void)
 	pthread_attr_init(&attr);
 	pthread_attr_setstacksize(&attr, 16*1024*1024);
 
-	err = 0;
 	while (bounces--) {
 		unsigned long expected_ioctls;
 
@@ -1407,25 +1259,18 @@ static int userfaultfd_stress(void)
 		uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
 		if (test_uffdio_wp)
 			uffdio_register.mode |= UFFDIO_REGISTER_MODE_WP;
-		if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register)) {
-			fprintf(stderr, "register failure\n");
-			return 1;
-		}
+		if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register))
+			err("register failure");
 		expected_ioctls = uffd_test_ops->expected_ioctls;
 		if ((uffdio_register.ioctls & expected_ioctls) !=
-		    expected_ioctls) {
-			fprintf(stderr,
-				"unexpected missing ioctl for anon memory\n");
-			return 1;
-		}
+		    expected_ioctls)
+			err("unexpected missing ioctl for anon memory");
 
 		if (area_dst_alias) {
 			uffdio_register.range.start = (unsigned long)
 				area_dst_alias;
-			if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register)) {
-				fprintf(stderr, "register failure alias\n");
-				return 1;
-			}
+			if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register))
+				err("register failure alias");
 		}
 
 		/*
@@ -1452,8 +1297,7 @@ static int userfaultfd_stress(void)
 		 * MADV_DONTNEED only after the UFFDIO_REGISTER, so it's
 		 * required to MADV_DONTNEED here.
 		 */
-		if (uffd_test_ops->release_pages(area_dst))
-			return 1;
+		uffd_test_ops->release_pages(area_dst);
 
 		uffd_stats_reset(uffd_stats, nr_cpus);
 
@@ -1467,33 +1311,22 @@ static int userfaultfd_stress(void)
 				 nr_pages * page_size, false);
 
 		/* unregister */
-		if (ioctl(uffd, UFFDIO_UNREGISTER, &uffdio_register.range)) {
-			fprintf(stderr, "unregister failure\n");
-			return 1;
-		}
+		if (ioctl(uffd, UFFDIO_UNREGISTER, &uffdio_register.range))
+			err("unregister failure");
 		if (area_dst_alias) {
 			uffdio_register.range.start = (unsigned long) area_dst;
 			if (ioctl(uffd, UFFDIO_UNREGISTER,
-				  &uffdio_register.range)) {
-				fprintf(stderr, "unregister failure alias\n");
-				return 1;
-			}
+				  &uffdio_register.range))
+				err("unregister failure alias");
 		}
 
 		/* verification */
-		if (bounces & BOUNCE_VERIFY) {
-			for (nr = 0; nr < nr_pages; nr++) {
-				if (*area_count(area_dst, nr) != count_verify[nr]) {
-					fprintf(stderr,
-						"error area_count %Lu %Lu %lu\n",
-						*area_count(area_src, nr),
-						count_verify[nr],
-						nr);
-					err = 1;
-					bounces = 0;
-				}
-			}
-		}
+		if (bounces & BOUNCE_VERIFY)
+			for (nr = 0; nr < nr_pages; nr++)
+				if (*area_count(area_dst, nr) != count_verify[nr])
+					err("error area_count %llu %llu %lu\n",
+					    *area_count(area_src, nr),
+					    count_verify[nr], nr);
 
 		/* prepare next bounce */
 		tmp_area = area_src;
@@ -1507,9 +1340,6 @@ static int userfaultfd_stress(void)
 		uffd_stats_report(uffd_stats, nr_cpus);
 	}
 
-	if (err)
-		return err;
-
 	close(uffd);
 	return userfaultfd_zeropage_test() || userfaultfd_sig_test()
 		|| userfaultfd_events_test() || userfaultfd_minor_test();
@@ -1560,7 +1390,7 @@ static void set_test_type(const char *ty
 		test_type = TEST_SHMEM;
 		uffd_test_ops = &shmem_uffd_test_ops;
 	} else {
-		fprintf(stderr, "Unknown test type: %s\n", type); exit(1);
+		err("Unknown test type: %s", type);
 	}
 
 	if (test_type == TEST_HUGETLB)
@@ -1568,15 +1398,11 @@ static void set_test_type(const char *ty
 	else
 		page_size = sysconf(_SC_PAGE_SIZE);
 
-	if (!page_size) {
-		fprintf(stderr, "Unable to determine page size\n");
-		exit(2);
-	}
+	if (!page_size)
+		err("Unable to determine page size");
 	if ((unsigned long) area_count(NULL, 0) + sizeof(unsigned long long) * 2
-	    > page_size) {
-		fprintf(stderr, "Impossible to run this test\n");
-		exit(2);
-	}
+	    > page_size)
+		err("Impossible to run this test");
 }
 
 static void sigalrm(int sig)
@@ -1593,10 +1419,8 @@ int main(int argc, char **argv)
 	if (argc < 4)
 		usage();
 
-	if (signal(SIGALRM, sigalrm) == SIG_ERR) {
-		fprintf(stderr, "failed to arm SIGALRM");
-		exit(1);
-	}
+	if (signal(SIGALRM, sigalrm) == SIG_ERR)
+		err("failed to arm SIGALRM");
 	alarm(ALARM_INTERVAL_SECS);
 
 	set_test_type(argv[1]);
@@ -1605,13 +1429,13 @@ int main(int argc, char **argv)
 	nr_pages_per_cpu = atol(argv[2]) * 1024*1024 / page_size /
 		nr_cpus;
 	if (!nr_pages_per_cpu) {
-		fprintf(stderr, "invalid MiB\n");
+		_err("invalid MiB");
 		usage();
 	}
 
 	bounces = atoi(argv[3]);
 	if (bounces <= 0) {
-		fprintf(stderr, "invalid bounces\n");
+		_err("invalid bounces");
 		usage();
 	}
 	nr_pages = nr_pages_per_cpu * nr_cpus;
@@ -1620,16 +1444,10 @@ int main(int argc, char **argv)
 		if (argc < 5)
 			usage();
 		huge_fd = open(argv[4], O_CREAT | O_RDWR, 0755);
-		if (huge_fd < 0) {
-			fprintf(stderr, "Open of %s failed", argv[3]);
-			perror("open");
-			exit(1);
-		}
-		if (ftruncate(huge_fd, 0)) {
-			fprintf(stderr, "ftruncate %s to size 0 failed", argv[3]);
-			perror("ftruncate");
-			exit(1);
-		}
+		if (huge_fd < 0)
+			err("Open of %s failed", argv[4]);
+		if (ftruncate(huge_fd, 0))
+			err("ftruncate %s to size 0 failed", argv[4]);
 	}
 	printf("nr_pages: %lu, nr_pages_per_cpu: %lu\n",
 	       nr_pages, nr_pages_per_cpu);
_


  parent reply	other threads:[~2021-07-01  1:48 UTC|newest]

Thread overview: 216+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  1:46 incoming Andrew Morton
2021-07-01  1:47 ` [patch 001/192] mm: memory_hotplug: factor out bootmem core functions to bootmem_info.c Andrew Morton
2021-07-01  1:47 ` [patch 002/192] mm: hugetlb: introduce a new config HUGETLB_PAGE_FREE_VMEMMAP Andrew Morton
2021-07-01  1:47 ` [patch 003/192] mm: hugetlb: gather discrete indexes of tail page Andrew Morton
2021-07-01  1:47 ` [patch 004/192] mm: hugetlb: free the vmemmap pages associated with each HugeTLB page Andrew Morton
2021-07-01  3:46   ` Linus Torvalds
2021-07-01  6:29     ` [External] " Muchun Song
2021-07-01 18:25       ` Linus Torvalds
2021-07-01  1:47 ` [patch 005/192] mm: hugetlb: defer freeing of HugeTLB pages Andrew Morton
2021-07-01  1:47 ` [patch 006/192] mm: hugetlb: alloc the vmemmap pages associated with each HugeTLB page Andrew Morton
2021-07-01  1:47 ` [patch 007/192] mm: hugetlb: add a kernel parameter hugetlb_free_vmemmap Andrew Morton
2021-07-01  1:47 ` [patch 008/192] mm: memory_hotplug: disable memmap_on_memory when hugetlb_free_vmemmap enabled Andrew Morton
2021-07-01  1:47 ` [patch 009/192] mm: hugetlb: introduce nr_free_vmemmap_pages in the struct hstate Andrew Morton
2021-07-01  1:47 ` [patch 010/192] mm/debug_vm_pgtable: move {pmd/pud}_huge_tests out of CONFIG_TRANSPARENT_HUGEPAGE Andrew Morton
2021-07-01  1:47 ` [patch 011/192] mm/debug_vm_pgtable: remove redundant pfn_{pmd/pte}() and fix one comment mistake Andrew Morton
2021-07-01  1:47 ` [patch 012/192] mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK Andrew Morton
2021-07-01  1:47 ` [patch 013/192] mm/huge_memory.c: use page->deferred_list Andrew Morton
2021-07-01  1:47 ` [patch 014/192] mm/huge_memory.c: add missing read-only THP checking in transparent_hugepage_enabled() Andrew Morton
2021-07-01  1:47 ` [patch 015/192] mm/huge_memory.c: remove unnecessary tlb_remove_page_size() for huge zero pmd Andrew Morton
2021-07-01  1:47 ` [patch 016/192] mm/huge_memory.c: don't discard hugepage if other processes are mapping it Andrew Morton
2021-07-01  1:48 ` [patch 017/192] mm/hugetlb: change parameters of arch_make_huge_pte() Andrew Morton
2021-07-01  1:48 ` [patch 018/192] mm/pgtable: add stubs for {pmd/pub}_{set/clear}_huge Andrew Morton
2021-07-01  1:48 ` [patch 019/192] mm/vmalloc: enable mapping of huge pages at pte level in vmap Andrew Morton
2021-07-01  1:48 ` [patch 020/192] mm/vmalloc: enable mapping of huge pages at pte level in vmalloc Andrew Morton
2021-07-01  1:48 ` [patch 021/192] powerpc/8xx: add support for huge pages on VMAP and VMALLOC Andrew Morton
2021-07-01  1:48 ` [patch 022/192] khugepaged: selftests: remove debug_cow Andrew Morton
2021-07-01  1:48 ` [patch 023/192] mm, hugetlb: fix racy resv_huge_pages underflow on UFFDIO_COPY Andrew Morton
2021-07-12 14:48   ` Matthew Wilcox
2021-07-12 16:58     ` Mike Kravetz
2021-07-12 19:28       ` Mina Almasry
2021-07-01  1:48 ` [patch 024/192] mm: sparsemem: split the huge PMD mapping of vmemmap pages Andrew Morton
2021-07-01  1:48 ` [patch 025/192] mm: sparsemem: use huge PMD mapping for " Andrew Morton
2021-07-01  1:48 ` [patch 026/192] mm: hugetlb: introduce CONFIG_HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON Andrew Morton
2021-07-01  1:48 ` [patch 027/192] hugetlb: remove prep_compound_huge_page cleanup Andrew Morton
2021-07-01  1:48 ` [patch 028/192] hugetlb: address ref count racing in prep_compound_gigantic_page Andrew Morton
2021-07-01  1:48 ` [patch 029/192] mm/hwpoison: disable pcp for page_handle_poison() Andrew Morton
2021-07-01  1:48 ` [patch 030/192] userfaultfd/selftests: use user mode only Andrew Morton
2021-07-01  1:48 ` [patch 031/192] userfaultfd/selftests: remove the time() check on delayed uffd Andrew Morton
2021-07-01  1:48 ` [patch 032/192] userfaultfd/selftests: dropping VERIFY check in locking_thread Andrew Morton
2021-07-01  1:48 ` [patch 033/192] userfaultfd/selftests: only dump counts if mode enabled Andrew Morton
2021-07-01  1:48 ` Andrew Morton [this message]
2021-07-01  1:48 ` [patch 035/192] mm/thp: simplify copying of huge zero page pmd when fork Andrew Morton
2021-07-01  1:49 ` [patch 036/192] mm/userfaultfd: fix uffd-wp special cases for fork() Andrew Morton
2021-07-01  1:49 ` [patch 037/192] mm/userfaultfd: fail uffd-wp registration if not supported Andrew Morton
2021-07-01  1:49 ` [patch 038/192] mm/pagemap: export uffd-wp protection information Andrew Morton
2021-07-01  1:49 ` [patch 039/192] userfaultfd/selftests: add pagemap uffd-wp test Andrew Morton
2021-07-01  1:49 ` [patch 040/192] userfaultfd/shmem: combine shmem_{mcopy_atomic,mfill_zeropage}_pte Andrew Morton
2021-07-01  1:49 ` [patch 041/192] userfaultfd/shmem: support minor fault registration for shmem Andrew Morton
2021-07-01  1:49 ` [patch 042/192] userfaultfd/shmem: support UFFDIO_CONTINUE " Andrew Morton
2021-07-01  1:49 ` [patch 043/192] userfaultfd/shmem: advertise shmem minor fault support Andrew Morton
2021-07-01  1:49 ` [patch 044/192] userfaultfd/shmem: modify shmem_mfill_atomic_pte to use install_pte() Andrew Morton
2021-07-01  1:49 ` [patch 045/192] userfaultfd/selftests: use memfd_create for shmem test type Andrew Morton
2021-07-01  1:49 ` [patch 046/192] userfaultfd/selftests: create alias mappings in the shmem test Andrew Morton
2021-07-01  1:49 ` [patch 047/192] userfaultfd/selftests: reinitialize test context in each test Andrew Morton
2021-07-01  1:49 ` [patch 048/192] userfaultfd/selftests: exercise minor fault handling shmem support Andrew Morton
2021-07-01  1:49 ` [patch 049/192] mm/vmscan.c: fix potential deadlock in reclaim_pages() Andrew Morton
2021-07-01  1:49 ` [patch 050/192] include/trace/events/vmscan.h: remove mm_vmscan_inactive_list_is_low Andrew Morton
2021-07-01  1:49 ` [patch 051/192] mm: workingset: define macro WORKINGSET_SHIFT Andrew Morton
2021-07-01  1:49 ` [patch 052/192] mm/kconfig: move HOLES_IN_ZONE into mm Andrew Morton
2021-07-01  1:50 ` [patch 053/192] docs: proc.rst: meminfo: briefly describe gaps in memory accounting Andrew Morton
2021-07-01  1:50 ` [patch 054/192] fs/proc/kcore: drop KCORE_REMAP and KCORE_OTHER Andrew Morton
2021-07-01  1:50 ` [patch 055/192] fs/proc/kcore: pfn_is_ram check only applies to KCORE_RAM Andrew Morton
2021-07-01  1:50 ` [patch 056/192] fs/proc/kcore: don't read offline sections, logically offline pages and hwpoisoned pages Andrew Morton
2021-07-01  1:50 ` [patch 057/192] mm: introduce page_offline_(begin|end|freeze|thaw) to synchronize setting PageOffline() Andrew Morton
2021-07-01  1:50 ` [patch 058/192] virtio-mem: use page_offline_(start|end) when " Andrew Morton
2021-07-01  1:50 ` [patch 059/192] fs/proc/kcore: use page_offline_(freeze|thaw) Andrew Morton
2021-07-01  1:50 ` [patch 060/192] mm/z3fold: define macro NCHUNKS as TOTAL_CHUNKS - ZHDR_CHUNKS Andrew Morton
2021-07-01  1:50 ` [patch 061/192] mm/z3fold: avoid possible underflow in z3fold_alloc() Andrew Morton
2021-07-01  1:50 ` [patch 062/192] mm/z3fold: remove magic number in z3fold_create_pool() Andrew Morton
2021-07-01  1:50 ` [patch 063/192] mm/z3fold: remove unused function handle_to_z3fold_header() Andrew Morton
2021-07-01  1:50 ` [patch 064/192] mm/z3fold: fix potential memory leak in z3fold_destroy_pool() Andrew Morton
2021-07-01  1:50 ` [patch 065/192] mm/z3fold: use release_z3fold_page_locked() to release locked z3fold page Andrew Morton
2021-07-01  1:50 ` [patch 066/192] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool Andrew Morton
2021-07-01  1:50 ` [patch 067/192] mm/zbud: don't export any zbud API Andrew Morton
2021-07-01  1:50 ` [patch 068/192] mm/compaction: use DEVICE_ATTR_WO macro Andrew Morton
2021-07-01  1:50 ` [patch 069/192] mm: compaction: remove duplicate !list_empty(&sublist) check Andrew Morton
2021-07-01  1:50 ` [patch 070/192] mm/compaction: fix 'limit' in fast_isolate_freepages Andrew Morton
2021-07-01  1:50 ` [patch 071/192] mm/mempolicy: cleanup nodemask intersection check for oom Andrew Morton
2021-07-01  1:51 ` [patch 072/192] mm/mempolicy: don't handle MPOL_LOCAL like a fake MPOL_PREFERRED policy Andrew Morton
2021-07-01  1:51 ` [patch 073/192] mm/mempolicy: unify the parameter sanity check for mbind and set_mempolicy Andrew Morton
2021-07-01  1:51 ` [patch 074/192] mm: mempolicy: don't have to split pmd for huge zero page Andrew Morton
2021-07-01  1:51 ` [patch 075/192] mm/mempolicy: use unified 'nodes' for bind/interleave/prefer policies Andrew Morton
2021-07-01  1:51 ` [patch 076/192] include/linux/mmzone.h: add documentation for pfn_valid() Andrew Morton
2021-07-01  1:51 ` [patch 077/192] memblock: update initialization of reserved pages Andrew Morton
2021-07-01  1:51 ` [patch 078/192] arm64: decouple check whether pfn is in linear map from pfn_valid() Andrew Morton
2021-07-01  1:51 ` [patch 079/192] arm64: drop pfn_valid_within() and simplify pfn_valid() Andrew Morton
2021-07-01  1:51 ` [patch 080/192] arm64/mm: drop HAVE_ARCH_PFN_VALID Andrew Morton
2021-07-01  1:51 ` [patch 081/192] mm: migrate: fix missing update page_private to hugetlb_page_subpool Andrew Morton
2021-07-01  1:51 ` [patch 082/192] mm, thp: relax the VM_DENYWRITE constraint on file-backed THPs Andrew Morton
2021-07-01  1:51 ` [patch 083/192] mm: memory: add orig_pmd to struct vm_fault Andrew Morton
2021-07-01  1:51 ` [patch 084/192] mm: memory: make numa_migrate_prep() non-static Andrew Morton
2021-07-01  1:51 ` [patch 085/192] mm: thp: refactor NUMA fault handling Andrew Morton
2021-07-01  1:51 ` [patch 086/192] mm: migrate: account THP NUMA migration counters correctly Andrew Morton
2021-07-01  1:51 ` [patch 087/192] mm: migrate: don't split THP for misplaced NUMA page Andrew Morton
2021-07-01  1:51 ` [patch 088/192] mm: migrate: check mapcount for THP instead of refcount Andrew Morton
2021-07-01  1:51 ` [patch 089/192] mm: thp: skip make PMD PROT_NONE if THP migration is not supported Andrew Morton
2021-07-01  1:51 ` [patch 090/192] mm/thp: make ARCH_ENABLE_SPLIT_PMD_PTLOCK dependent on PGTABLE_LEVELS > 2 Andrew Morton
2021-07-01  1:52 ` [patch 091/192] mm: rmap: make try_to_unmap() void function Andrew Morton
2021-07-01  1:52 ` [patch 092/192] mm/thp: remap_page() is only needed on anonymous THP Andrew Morton
2021-07-01  1:52 ` [patch 093/192] mm: hwpoison_user_mappings() try_to_unmap() with TTU_SYNC Andrew Morton
2021-07-01  1:52 ` [patch 094/192] mm/thp: fix strncpy warning Andrew Morton
2021-07-01  1:52 ` [patch 095/192] nommu: remove __GFP_HIGHMEM in vmalloc/vzalloc Andrew Morton
2021-07-01  1:52 ` [patch 096/192] mm/nommu: unexport do_munmap() Andrew Morton
2021-07-01  1:52 ` [patch 097/192] mm: generalize ZONE_[DMA|DMA32] Andrew Morton
2021-07-01  1:52 ` [patch 098/192] mm: make variable names for populate_vma_page_range() consistent Andrew Morton
2021-07-01  1:52 ` [patch 099/192] mm/madvise: introduce MADV_POPULATE_(READ|WRITE) to prefault page tables Andrew Morton
2021-07-01  1:52 ` [patch 100/192] MAINTAINERS: add tools/testing/selftests/vm/ to MEMORY MANAGEMENT Andrew Morton
2021-07-01  1:52 ` [patch 101/192] selftests/vm: add protection_keys_32 / protection_keys_64 to gitignore Andrew Morton
2021-07-01  1:52 ` [patch 102/192] selftests/vm: add test for MADV_POPULATE_(READ|WRITE) Andrew Morton
2021-07-01  1:52 ` [patch 103/192] mm/memory_hotplug: rate limit page migration warnings Andrew Morton
2021-07-01  1:52 ` [patch 104/192] mm,memory_hotplug: drop unneeded locking Andrew Morton
2021-07-01  1:52 ` [patch 105/192] mm/zswap.c: remove unused function zswap_debugfs_exit() Andrew Morton
2021-07-01  1:52 ` [patch 106/192] mm/zswap.c: avoid unnecessary copy-in at map time Andrew Morton
2021-07-01  1:52 ` [patch 107/192] mm/zswap.c: fix two bugs in zswap_writeback_entry() Andrew Morton
2021-07-01  1:52 ` [patch 108/192] mm: zram: amend SLAB_RECLAIM_ACCOUNT on zspage_cachep Andrew Morton
2021-07-01 14:55   ` Minchan Kim
2021-07-01 18:07     ` Linus Torvalds
2021-07-02  2:45     ` Zhaoyang Huang
2021-07-02  5:47       ` Minchan Kim
2021-07-02  6:20         ` Zhaoyang Huang
2021-07-02  7:33           ` Minchan Kim
2021-07-01  1:53 ` [patch 109/192] mm/zsmalloc.c: remove confusing code in obj_free() Andrew Morton
2021-07-01  1:53 ` [patch 110/192] mm/zsmalloc.c: improve readability for async_free_zspage() Andrew Morton
2021-07-01  1:53 ` [patch 111/192] zram: move backing_dev under macro CONFIG_ZRAM_WRITEBACK Andrew Morton
2021-07-01  1:53 ` [patch 112/192] mm: fix typos and grammar error in comments Andrew Morton
2021-07-01  1:53 ` [patch 113/192] mm: define default value for FIRST_USER_ADDRESS Andrew Morton
2021-07-01  1:53 ` [patch 114/192] mm: fix spelling mistakes Andrew Morton
2021-07-01  1:53 ` [patch 115/192] mm/vmscan: remove kerneldoc-like comment from isolate_lru_pages Andrew Morton
2021-07-01  1:53 ` [patch 116/192] mm/vmalloc: include header for prototype of set_iounmap_nonlazy Andrew Morton
2021-07-01  1:53 ` [patch 117/192] mm/page_alloc: make should_fail_alloc_page() static Andrew Morton
2021-07-01  1:53 ` [patch 118/192] mm/mapping_dirty_helpers: remove double Note in kerneldoc Andrew Morton
2021-07-01  1:53 ` [patch 119/192] mm/memcontrol.c: fix kerneldoc comment for mem_cgroup_calculate_protection Andrew Morton
2021-07-01  1:53 ` [patch 120/192] mm/memory_hotplug: fix kerneldoc comment for __try_online_node Andrew Morton
2021-07-01  1:53 ` [patch 121/192] mm/memory_hotplug: fix kerneldoc comment for __remove_memory Andrew Morton
2021-07-01  1:53 ` [patch 122/192] mm/zbud: add kerneldoc fields for zbud_pool Andrew Morton
2021-07-01  1:53 ` [patch 123/192] mm/z3fold: add kerneldoc fields for z3fold_pool Andrew Morton
2021-07-01  1:53 ` [patch 124/192] mm/swap: make swap_address_space an inline function Andrew Morton
2021-07-01  1:53 ` [patch 125/192] mm/mmap_lock: remove dead code for !CONFIG_TRACING configurations Andrew Morton
2021-07-01  1:53 ` [patch 126/192] mm/page_alloc: move prototype for find_suitable_fallback Andrew Morton
2021-07-01  1:53 ` [patch 127/192] mm/swap: make NODE_DATA an inline function on CONFIG_FLATMEM Andrew Morton
2021-07-01  1:53 ` [patch 128/192] mm/thp: define default pmd_pgtable() Andrew Morton
2021-07-01  1:54 ` [patch 129/192] kfence: unconditionally use unbound work queue Andrew Morton
2021-07-01  1:54 ` [patch 130/192] mm: remove special swap entry functions Andrew Morton
2021-07-01  1:54 ` [patch 131/192] mm/swapops: rework swap entry manipulation code Andrew Morton
2021-07-01  1:54 ` [patch 132/192] mm/rmap: split try_to_munlock from try_to_unmap Andrew Morton
2021-07-01  1:54 ` [patch 133/192] mm/rmap: split migration into its own function Andrew Morton
2021-07-01  1:54 ` [patch 134/192] mm: rename migrate_pgmap_owner Andrew Morton
2021-07-01  1:54 ` [patch 135/192] mm/memory.c: allow different return codes for copy_nonpresent_pte() Andrew Morton
2021-07-01  1:54 ` [patch 136/192] mm: device exclusive memory access Andrew Morton
2021-07-01  1:54 ` [patch 137/192] mm: selftests for exclusive device memory Andrew Morton
2021-07-01  1:54 ` [patch 138/192] nouveau/svm: refactor nouveau_range_fault Andrew Morton
2021-07-01  1:54 ` [patch 139/192] nouveau/svm: implement atomic SVM access Andrew Morton
2021-07-01  1:54 ` [patch 140/192] proc: Avoid mixing integer types in mem_rw() Andrew Morton
2021-07-01  1:54 ` [patch 141/192] fs/proc/kcore.c: add mmap interface Andrew Morton
2021-07-01  3:32   ` Linus Torvalds
2021-07-01  6:35     ` [External] " zhoufeng
2021-07-01  1:54 ` [patch 142/192] procfs: allow reading fdinfo with PTRACE_MODE_READ Andrew Morton
2021-07-02 14:54   ` Christian Brauner
2021-07-02 18:43   ` Kees Cook
2021-07-02 19:00     ` Linus Torvalds
2021-07-02 20:40       ` Eric W. Biederman
2021-07-02 23:31         ` Kees Cook
2021-07-03  0:15           ` Linus Torvalds
2021-07-03 21:43             ` Eric W. Biederman
2021-07-01  1:54 ` [patch 143/192] procfs/dmabuf: add inode number to /proc/*/fdinfo Andrew Morton
2021-07-01  1:54 ` [patch 144/192] sysctl: remove redundant assignment to first Andrew Morton
2021-07-01  1:54 ` [patch 145/192] drm: include only needed headers in ascii85.h Andrew Morton
2021-07-01  1:54 ` [patch 146/192] kernel.h: split out panic and oops helpers Andrew Morton
2021-07-01  1:55 ` [patch 147/192] lib: decompress_bunzip2: remove an unneeded semicolon Andrew Morton
2021-07-01  1:55 ` [patch 148/192] lib/string_helpers: switch to use BIT() macro Andrew Morton
2021-07-01  1:55 ` [patch 149/192] lib/string_helpers: move ESCAPE_NP check inside 'else' branch in a loop Andrew Morton
2021-07-01  1:55 ` [patch 150/192] lib/string_helpers: drop indentation level in string_escape_mem() Andrew Morton
2021-07-01  1:55 ` [patch 151/192] lib/string_helpers: introduce ESCAPE_NA for escaping non-ASCII Andrew Morton
2021-07-01  1:55 ` [patch 152/192] lib/string_helpers: introduce ESCAPE_NAP to escape non-ASCII and non-printable Andrew Morton
2021-07-01  1:55 ` [patch 153/192] lib/string_helpers: allow to append additional characters to be escaped Andrew Morton
2021-07-01  1:55 ` [patch 154/192] lib/test-string_helpers: print flags in hexadecimal format Andrew Morton
2021-07-01  1:55 ` [patch 155/192] lib/test-string_helpers: get rid of trailing comma in terminators Andrew Morton
2021-07-01  1:55 ` [patch 156/192] lib/test-string_helpers: add test cases for new features Andrew Morton
2021-07-01  1:55 ` [patch 157/192] MAINTAINERS: add myself as designated reviewer for generic string library Andrew Morton
2021-07-01  1:55 ` [patch 158/192] seq_file: introduce seq_escape_mem() Andrew Morton
2021-07-01  1:55 ` [patch 159/192] seq_file: add seq_escape_str() as replica of string_escape_str() Andrew Morton
2021-07-01  1:55 ` [patch 160/192] seq_file: convert seq_escape() to use seq_escape_str() Andrew Morton
2021-07-01  1:55 ` [patch 161/192] nfsd: avoid non-flexible API in seq_quote_mem() Andrew Morton
2021-07-01  1:55 ` [patch 162/192] seq_file: drop unused *_escape_mem_ascii() Andrew Morton
2021-07-01  1:55 ` [patch 163/192] lib/math/rational.c: fix divide by zero Andrew Morton
2021-07-01  1:55 ` [patch 164/192] lib/math/rational: add Kunit test cases Andrew Morton
2021-07-01  1:55 ` [patch 165/192] lib/decompressors: fix spelling mistakes Andrew Morton
2021-07-01  1:55 ` [patch 166/192] lib/mpi: " Andrew Morton
2021-07-01  1:56 ` [patch 167/192] lib: memscan() fixlet Andrew Morton
2021-07-01  1:56 ` [patch 168/192] lib: uninline simple_strtoull() Andrew Morton
2021-07-01  1:56 ` [patch 169/192] lib/test_string.c: allow module removal Andrew Morton
2021-07-01  1:56 ` [patch 170/192] kernel.h: split out kstrtox() and simple_strtox() to a separate header Andrew Morton
2021-07-01  1:56 ` [patch 171/192] lz4_decompress: declare LZ4_decompress_safe_withPrefix64k static Andrew Morton
2021-07-01  1:56 ` [patch 172/192] lib/decompress_unlz4.c: correctly handle zero-padding around initrds Andrew Morton
2021-07-01  1:56 ` [patch 173/192] checkpatch: scripts/spdxcheck.py now requires python3 Andrew Morton
2021-07-01  1:56 ` [patch 174/192] checkpatch: improve the indented label test Andrew Morton
2021-07-01  1:56 ` [patch 175/192] checkpatch: do not complain about positive return values starting with EPOLL Andrew Morton
2021-07-01  1:56 ` [patch 176/192] init: print out unknown kernel parameters Andrew Morton
2021-07-01  1:56 ` [patch 177/192] kprobes: remove duplicated strong free_insn_page in x86 and s390 Andrew Morton
2021-07-01  1:56 ` [patch 178/192] nilfs2: remove redundant continue statement in a while-loop Andrew Morton
2021-07-01  1:56 ` [patch 179/192] hfsplus: remove unnecessary oom message Andrew Morton
2021-07-01  1:56 ` [patch 180/192] hfsplus: report create_date to kstat.btime Andrew Morton
2021-07-01  1:56 ` [patch 181/192] x86: signal: don't do sas_ss_reset() until we are certain that sigframe won't be abandoned Andrew Morton
2021-07-01  1:56 ` [patch 182/192] exec: remove checks in __register_bimfmt() Andrew Morton
2021-07-01  1:56 ` [patch 183/192] kcov: add __no_sanitize_coverage to fix noinstr for all architectures Andrew Morton
2021-07-01  1:56 ` [patch 184/192] selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random Andrew Morton
2021-07-01  1:56 ` [patch 185/192] selftests/vm/pkeys: handle negative sys_pkey_alloc() return code Andrew Morton
2021-07-01  1:56 ` [patch 186/192] selftests/vm/pkeys: refill shadow register after implicit kernel write Andrew Morton
2021-07-01  1:57 ` [patch 187/192] selftests/vm/pkeys: exercise x86 XSAVE init state Andrew Morton
2021-07-01  1:57 ` [patch 188/192] lib/decompressors: remove set but not used variabled 'level' Andrew Morton
2021-07-01  1:57 ` [patch 189/192] ipc sem: use kvmalloc for sem_undo allocation Andrew Morton
2021-07-01  1:57 ` [patch 190/192] ipc: use kmalloc for msg_queue and shmid_kernel Andrew Morton
2021-07-01  1:57 ` [patch 191/192] ipc/sem.c: use READ_ONCE()/WRITE_ONCE() for use_global_lock Andrew Morton
2021-07-01  1:57 ` [patch 192/192] ipc/util.c: use binary search for max_idx Andrew Morton
2021-07-03  0:28 ` incoming Linus Torvalds
2021-07-03  1:06   ` incoming Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210701014855._Z9WTu8lZ%akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aarcange@redhat.com \
    --cc=almasrymina@google.com \
    --cc=axelrasmussen@google.com \
    --cc=bgeffon@google.com \
    --cc=dgilbert@redhat.com \
    --cc=hughd@google.com \
    --cc=jglisse@redhat.com \
    --cc=joe@perches.com \
    --cc=kirill@shutemov.name \
    --cc=linux-mm@kvack.org \
    --cc=lokeshgidra@google.com \
    --cc=mike.kravetz@oracle.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=oupton@google.com \
    --cc=peterx@redhat.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=sfr@canb.auug.org.au \
    --cc=shli@fb.com \
    --cc=shuah@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wangqing@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).