aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWen Jin <wenx.jin@intel.com>2016-03-22 15:32:16 +0800
committerAndi Kleen <ak@linux.intel.com>2016-04-11 15:32:38 -0700
commitff05588f1aa117e73a82d10aa880d148d9c6cdc8 (patch)
tree02c463ca536770ff7b75f46437ac4d19a55f2b6a
parent42399a06a50b3de82c453f527ba8807b7f86f036 (diff)
downloadmce-test-ff05588f1aa117e73a82d10aa880d148d9c6cdc8.tar.gz
Update hugepage poison test case in hwpoison
1. get hugepage from /proc/meminfo. Don't support 1G hugepage yet 2. when vm.memory_failure_early_kill = 0, prctl command can toggle the kill policy correctly between early_kill and late_kill Signed-off-by: Wen Jin <wenx.jin@intel.com> Signed-off-by: Chen, Gong <gong.chen@linux.intel.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r--cases/function/hwpoison/hugepage.h18
-rwxr-xr-xcases/function/hwpoison/run_hard.sh3
2 files changed, 13 insertions, 8 deletions
diff --git a/cases/function/hwpoison/hugepage.h b/cases/function/hwpoison/hugepage.h
index 0ba9aad..6304878 100644
--- a/cases/function/hwpoison/hugepage.h
+++ b/cases/function/hwpoison/hugepage.h
@@ -85,18 +85,20 @@ int hugetlbfs_root(char *dir)
return found;
}
-/* Assume there is only one types of hugepage size for now. */
int gethugepagesize(void)
{
+ FILE *fp;
+ char *line = NULL;
+ size_t linelen = 0;
int hpagesize = 0;
- struct dirent *dent;
- DIR *dir;
- dir = opendir("/sys/kernel/mm/hugepages");
- if (!dir) err("open /sys/kernel/mm/hugepages");
- while ((dent = readdir(dir)) != NULL)
- if (sscanf(dent->d_name, "hugepages-%dkB", &hpagesize) >= 1)
+ if ((fp = fopen("/proc/meminfo", "r")) == NULL)
+ err("open /proc/meminfo");
+ while (getline(&line, &linelen, fp) > 0) {
+ if (sscanf(line, "Hugepagesize: %d kB", &hpagesize) >= 1)
break;
- closedir(dir);
+ }
+ free(line);
+ fclose(fp);
return hpagesize * 1024;
}
diff --git a/cases/function/hwpoison/run_hard.sh b/cases/function/hwpoison/run_hard.sh
index 802185f..548acb6 100755
--- a/cases/function/hwpoison/run_hard.sh
+++ b/cases/function/hwpoison/run_hard.sh
@@ -36,7 +36,10 @@ unmount_hugetlbfs
echo "------------------------------------------------------------------------"
echo "Running tprctl (hard offline test with various prctl settings)"
+val=`sysctl -n vm.memory_failure_early_kill`
+sysctl -w vm.memory_failure_early_kill=0
run_test ./tprctl success
+sysctl -w vm.memory_failure_early_kill=$val
free_resources