diff options
author | Peter Andreas Entschev <peter@entschev.com> | 2019-08-07 20:11:50 +0200 |
---|---|---|
committer | Peter Andreas Entschev <peter@entschev.com> | 2019-08-07 20:11:50 +0200 |
commit | 92fa9858db4a17f6818b4241a6d94ffbe7ba1170 (patch) | |
tree | eff9bb35aa413a68278944d42f76032886b8ca5e | |
parent | 0617d5cc5da20c52dd88eeeaf8c79cae9acd3dd5 (diff) | |
download | numpy-92fa9858db4a17f6818b4241a6d94ffbe7ba1170.tar.gz |
MAINT: comment on lack of error checks for madvise()
-rw-r--r-- | numpy/core/src/multiarray/alloc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/alloc.c b/numpy/core/src/multiarray/alloc.c index 54ce9f131..a7f34cbe5 100644 --- a/numpy/core/src/multiarray/alloc.c +++ b/numpy/core/src/multiarray/alloc.c @@ -83,6 +83,10 @@ _npy_alloc_cache(npy_uintp nelem, npy_uintp esz, npy_uint msz, if (NPY_UNLIKELY(nelem * esz >= ((1u<<22u)))) { npy_uintp offset = 4096u - (npy_uintp)p % (4096u); npy_uintp length = nelem * esz - offset; + /** + * Intentionally not checking for errors that may be returned by + * older kernel versions; optimistically tries enabling huge pages. + */ madvise((void*)((npy_uintp)p + offset), length, MADV_HUGEPAGE); } #endif |