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; return errno;
env->me_txns = m; env->me_txns = m;
if (madvise(env->me_txns, rsize, MADV_DONTFORK | MADV_WILLNEED)) #ifdef MADV_NOHUGEPAGE
return errno; (void) madvise(env->me_txns, rsize, MADV_NOHUGEPAGE);
#endif
#ifdef MADV_DODUMP #ifdef MADV_DODUMP
madvise(env->me_txns, rsize, MADV_DODUMP); (void) madvise(env->me_txns, rsize, MADV_DODUMP);
#endif #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) { if (*excl > 0) {
pthread_mutexattr_t mattr; pthread_mutexattr_t mattr;