aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-25 13:29:09 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-25 13:29:09 -0500
commit7b46588f364f4f40c25f43ceabb6f705d20793e2 (patch)
tree29e80019ee791abe58176161f3ae2b766749b808 /tools
parent915f3e3f76c05b2da93c4cc278eebc2d9219d9f4 (diff)
parent95330473636e5e4546f94874c957c3be66bb2140 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton: - almost all of the rest of MM - misc bits - KASAN updates - procfs - lib/ updates - checkpatch updates * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (124 commits) checkpatch: remove false unbalanced braces warning checkpatch: notice unbalanced else braces in a patch checkpatch: add another old address for the FSF checkpatch: update $logFunctions checkpatch: warn on logging continuations checkpatch: warn on embedded function names lib/lz4: remove back-compat wrappers fs/pstore: fs/squashfs: change usage of LZ4 to work with new LZ4 version crypto: change LZ4 modules to work with new LZ4 module version lib/decompress_unlz4: change module to work with new LZ4 module version lib: update LZ4 compressor module lib/test_sort.c: make it explicitly non-modular lib: add CONFIG_TEST_SORT to enable self-test of sort() rbtree: use designated initializers linux/kernel.h: fix DIV_ROUND_CLOSEST to support negative divisors lib/find_bit.c: micro-optimise find_next_*_bit lib: add module support to atomic64 tests lib: add module support to glob tests lib: add module support to crc32 tests kernel/ksysfs.c: add __ro_after_init to bin_attribute structure ...
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/find_bit.c2
-rw-r--r--tools/testing/selftests/vm/userfaultfd.c22
2 files changed, 11 insertions, 13 deletions
diff --git a/tools/lib/find_bit.c b/tools/lib/find_bit.c
index 6d8b8f22cf55..42c15f906aac 100644
--- a/tools/lib/find_bit.c
+++ b/tools/lib/find_bit.c
@@ -34,7 +34,7 @@ static unsigned long _find_next_bit(const unsigned long *addr,
34{ 34{
35 unsigned long tmp; 35 unsigned long tmp;
36 36
37 if (!nbits || start >= nbits) 37 if (unlikely(start >= nbits))
38 return nbits; 38 return nbits;
39 39
40 tmp = addr[start / BITS_PER_LONG] ^ invert; 40 tmp = addr[start / BITS_PER_LONG] ^ invert;
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index 5a840a605a16..e9449c801888 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -398,12 +398,12 @@ static void *uffd_poll_thread(void *arg)
398 uffd = msg.arg.fork.ufd; 398 uffd = msg.arg.fork.ufd;
399 pollfd[0].fd = uffd; 399 pollfd[0].fd = uffd;
400 break; 400 break;
401 case UFFD_EVENT_MADVDONTNEED: 401 case UFFD_EVENT_REMOVE:
402 uffd_reg.range.start = msg.arg.madv_dn.start; 402 uffd_reg.range.start = msg.arg.remove.start;
403 uffd_reg.range.len = msg.arg.madv_dn.end - 403 uffd_reg.range.len = msg.arg.remove.end -
404 msg.arg.madv_dn.start; 404 msg.arg.remove.start;
405 if (ioctl(uffd, UFFDIO_UNREGISTER, &uffd_reg.range)) 405 if (ioctl(uffd, UFFDIO_UNREGISTER, &uffd_reg.range))
406 fprintf(stderr, "madv_dn failure\n"), exit(1); 406 fprintf(stderr, "remove failure\n"), exit(1);
407 break; 407 break;
408 case UFFD_EVENT_REMAP: 408 case UFFD_EVENT_REMAP:
409 area_dst = (char *)(unsigned long)msg.arg.remap.to; 409 area_dst = (char *)(unsigned long)msg.arg.remap.to;
@@ -569,9 +569,9 @@ static int userfaultfd_open(int features)
569 * part is accessed after mremap. Since hugetlbfs does not support 569 * part is accessed after mremap. Since hugetlbfs does not support
570 * mremap, the entire monitored area is accessed in a single pass for 570 * mremap, the entire monitored area is accessed in a single pass for
571 * HUGETLB_TEST. 571 * HUGETLB_TEST.
572 * The release of the pages currently generates event only for 572 * The release of the pages currently generates event for shmem and
573 * anonymous memory (UFFD_EVENT_MADVDONTNEED), hence it is not checked 573 * anonymous memory (UFFD_EVENT_REMOVE), hence it is not checked
574 * for hugetlb and shmem. 574 * for hugetlb.
575 */ 575 */
576static int faulting_process(void) 576static int faulting_process(void)
577{ 577{
@@ -610,7 +610,6 @@ static int faulting_process(void)
610 } 610 }
611 } 611 }
612 612
613#ifndef SHMEM_TEST
614 if (release_pages(area_dst)) 613 if (release_pages(area_dst))
615 return 1; 614 return 1;
616 615
@@ -618,7 +617,6 @@ static int faulting_process(void)
618 if (my_bcmp(area_dst + nr * page_size, zeropage, page_size)) 617 if (my_bcmp(area_dst + nr * page_size, zeropage, page_size))
619 fprintf(stderr, "nr %lu is not zero\n", nr), exit(1); 618 fprintf(stderr, "nr %lu is not zero\n", nr), exit(1);
620 } 619 }
621#endif /* SHMEM_TEST */
622 620
623#endif /* HUGETLB_TEST */ 621#endif /* HUGETLB_TEST */
624 622
@@ -715,14 +713,14 @@ static int userfaultfd_events_test(void)
715 pid_t pid; 713 pid_t pid;
716 char c; 714 char c;
717 715
718 printf("testing events (fork, remap, madv_dn): "); 716 printf("testing events (fork, remap, remove): ");
719 fflush(stdout); 717 fflush(stdout);
720 718
721 if (release_pages(area_dst)) 719 if (release_pages(area_dst))
722 return 1; 720 return 1;
723 721
724 features = UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | 722 features = UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP |
725 UFFD_FEATURE_EVENT_MADVDONTNEED; 723 UFFD_FEATURE_EVENT_REMOVE;
726 if (userfaultfd_open(features) < 0) 724 if (userfaultfd_open(features) < 0)
727 return 1; 725 return 1;
728 fcntl(uffd, F_SETFL, uffd_flags | O_NONBLOCK); 726 fcntl(uffd, F_SETFL, uffd_flags | O_NONBLOCK);