mdbx: fix madvise() flags.

Change-Id: If0ed3cd972fbc0caea486656ae05526aa2022574
This commit is contained in:
Leo Yuriev 2016-01-13 18:02:47 +03:00
parent 2477997658
commit c9c0549b4f

16
mdb.c
View File

@ -4731,13 +4731,23 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
return errno;
env->me_txns = m;
if (madvise(env->me_txns, rsize, MADV_DONTFORK | MADV_WILLNEED))
return errno;
#ifdef MADV_NOHUGEPAGE
(void) madvise(env->me_txns, rsize, MADV_NOHUGEPAGE);
#endif
#ifdef MADV_DODUMP
madvise(env->me_txns, rsize, MADV_DODUMP);
(void) madvise(env->me_txns, rsize, MADV_DODUMP);
#endif
if (madvise(env->me_txns, rsize, MADV_DONTFORK) < 0)
return errno;
if (madvise(env->me_txns, rsize, MADV_WILLNEED) < 0)
return errno;
if (madvise(env->me_txns, rsize, MADV_RANDOM) < 0)
return errno;
if (*excl > 0) {
pthread_mutexattr_t mattr;