aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric B Munson <emunson@mgebm.net>2010-11-03 09:56:53 -0600
committerEric B Munson <emunson@mgebm.net>2010-11-09 13:50:22 -0700
commitaf9467a5bfbb2fc9696882b1f46ff6b88d794022 (patch)
tree44b0eeea547d0d24079624802fb5730a0c6134db
parentd871b423f989ab89109369622eae7db3c120181c (diff)
downloadlibhugetlbfs-af9467a5bfbb2fc9696882b1f46ff6b88d794022.tar.gz
Fix return value tests for hugetlbfs_test_feature
The function hugetlbfs_test_feature currently returns 0 if the requested feature is not present, a positive integer if the feature is present, and -ENOSYS if the requested feature is invalid. The way that hugetlbfs_test_feature is currently used is any non-zero return value means the requested feature is present. This patch corrects this usage to use only positive integer return values to mean a feature is present. Signed-off-by: Eric B Munson <emunson@mgebm.net>
-rw-r--r--hugeutils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hugeutils.c b/hugeutils.c
index 3a9501f..4e6afd8 100644
--- a/hugeutils.c
+++ b/hugeutils.c
@@ -318,7 +318,7 @@ void hugetlbfs_check_priv_resv()
* prefaulting the huge pages we allocate since the kernel
* guarantees them. This can help NUMA performance quite a bit.
*/
- if (hugetlbfs_test_feature(HUGETLB_FEATURE_PRIVATE_RESV)) {
+ if (hugetlbfs_test_feature(HUGETLB_FEATURE_PRIVATE_RESV) > 0) {
INFO("Kernel has MAP_PRIVATE reservations. Disabling "
"heap prefaulting.\n");
__hugetlbfs_prefault = 0;
@@ -333,7 +333,7 @@ void hugetlbfs_check_safe_noreserve()
* the user of NORESERVE where necessary
*/
if (__hugetlb_opts.no_reserve &&
- !hugetlbfs_test_feature(HUGETLB_FEATURE_SAFE_NORESERVE)) {
+ hugetlbfs_test_feature(HUGETLB_FEATURE_SAFE_NORESERVE) <= 0) {
INFO("Kernel is not safe for MAP_NORESERVE. Forcing "
"use of reservations.\n");
__hugetlb_opts.no_reserve = 0;