diff options
author | Milosz Wasilewski <milosz.wasilewski@hackbox.linaro.org> | 2014-10-02 10:16:18 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@hackbox.linaro.org> | 2014-10-02 10:16:18 +0100 |
commit | 8b27a74bc734d860958941b1a331aa7b38bc2af4 (patch) | |
tree | 90f368cfd48a916aa52ddbd3356a7ef2224384a8 /powerpc/mm/hugetlb_vs_thp_test.c | |
parent | e14eb051ff73ab8692770762adf44045ba092398 (diff) |
Update to 54cd4bea5a18f7bd5921a76d31eef4c61a68d8e7 from repo http://git.linaro.org/kernel/linux-linaro-stable.git branch linux-linaro-lsk-v3.10f6e46ae658e4443e765f87702603deca167f2b57f1326e0892329b0d58dec467f71f5d94c4d5d5a9d266af7f712dc494727b6a18e26fb123911884d5ceafc84623c8ef94c13a87363277a595988b2b79c810fcb930d9c705774427bb6eb551b2e1108adbc293f79246d7cdaf6e75b40aa1f957eb8d195835bbba26b2fc88c77239ebcd45d7fb669018511dfeba0bfedf4c9cad58f56a7038d1462ffc21cd33dfb94eedf4bb47fe789e3947875beb24f558ebd11988720d8b842c59efcc0c4dc17e2107f4dae502f580124ed1ec12ae83dfdcae3ca15e491a813c1729709d22822886bfb105a1c498c14ab6647d0f1284692d96aa22dea8bb80018c6a76556ad6afd464a654cd4bea5a18f7bd5921a76d31eef4c61a68d8e743e7406efd7822d75c64310461d2cbca0ece19f02eb736d6b425cb932b038fd555243b9b0e59c0362156eda2aafa0b0f660656246a11d7c2a9947ff91874098820e8269fe88d67bc08c908134dd8710215f82fce54b86e159fe5a1d41dcdc89e12b264590bde84f40232e0f81bb9fa79d7953fed4a32811clinux-linaro-stable-3.10
Diffstat (limited to 'powerpc/mm/hugetlb_vs_thp_test.c')
-rw-r--r-- | powerpc/mm/hugetlb_vs_thp_test.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/powerpc/mm/hugetlb_vs_thp_test.c b/powerpc/mm/hugetlb_vs_thp_test.c deleted file mode 100644 index 3d8e5b0..0000000 --- a/powerpc/mm/hugetlb_vs_thp_test.c +++ /dev/null @@ -1,72 +0,0 @@ -#include <stdio.h> -#include <sys/mman.h> -#include <unistd.h> - -#include "utils.h" - -/* This must match the huge page & THP size */ -#define SIZE (16 * 1024 * 1024) - -static int test_body(void) -{ - void *addr; - char *p; - - addr = (void *)0xa0000000; - - p = mmap(addr, SIZE, PROT_READ | PROT_WRITE, - MAP_HUGETLB | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - if (p != MAP_FAILED) { - /* - * Typically the mmap will fail because no huge pages are - * allocated on the system. But if there are huge pages - * allocated the mmap will succeed. That's fine too, we just - * munmap here before continuing. - */ - munmap(addr, SIZE); - } - - p = mmap(addr, SIZE, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - if (p == MAP_FAILED) { - printf("Mapping failed @ %p\n", addr); - perror("mmap"); - return 1; - } - - /* - * Either a user or kernel access is sufficient to trigger the bug. - * A kernel access is easier to spot & debug, as it will trigger the - * softlockup or RCU stall detectors, and when the system is kicked - * into xmon we get a backtrace in the kernel. - * - * A good option is: - * getcwd(p, SIZE); - * - * For the purposes of this testcase it's preferable to spin in - * userspace, so the harness can kill us if we get stuck. That way we - * see a test failure rather than a dead system. - */ - *p = 0xf; - - munmap(addr, SIZE); - - return 0; -} - -static int test_main(void) -{ - int i; - - /* 10,000 because it's a "bunch", and completes reasonably quickly */ - for (i = 0; i < 10000; i++) - if (test_body()) - return 1; - - return 0; -} - -int main(void) -{ - return test_harness(test_main, "hugetlb_vs_thp"); -} |