mirror of
https://github.com/matrix-construct/construct
synced 2025-02-27 22:20:15 +01:00
ircd::db: Disable cache lock feature when valgrinding.
This commit is contained in:
parent
da43ac3d95
commit
e12774595c
2 changed files with 11 additions and 1 deletions
11
ircd/db.cc
11
ircd/db.cc
|
@ -3539,6 +3539,15 @@ ircd::db::database::allocator::mlock_limit
|
||||||
ircd::allocator::rlimit_memlock()
|
ircd::allocator::rlimit_memlock()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
decltype(ircd::db::database::allocator::mlock_enabled)
|
||||||
|
ircd::db::database::allocator::mlock_enabled
|
||||||
|
{
|
||||||
|
mlock_limit == -1UL
|
||||||
|
|
||||||
|
// mlock2() not supported by valgrind
|
||||||
|
&& !vg::active()
|
||||||
|
};
|
||||||
|
|
||||||
decltype(ircd::db::database::allocator::mlock_current)
|
decltype(ircd::db::database::allocator::mlock_current)
|
||||||
ircd::db::database::allocator::mlock_current;
|
ircd::db::database::allocator::mlock_current;
|
||||||
|
|
||||||
|
@ -3632,7 +3641,7 @@ noexcept
|
||||||
// This feature is only enabled when RLIMIT_MEMLOCK is unlimited. We don't
|
// This feature is only enabled when RLIMIT_MEMLOCK is unlimited. We don't
|
||||||
// want to deal with any limit at all.
|
// want to deal with any limit at all.
|
||||||
#if defined(HAVE_MLOCK2) && defined(MLOCK_ONFAULT)
|
#if defined(HAVE_MLOCK2) && defined(MLOCK_ONFAULT)
|
||||||
if(database::allocator::mlock_limit == -1UL)
|
if(database::allocator::mlock_enabled)
|
||||||
{
|
{
|
||||||
syscall(::mlock2, ret, size, MLOCK_ONFAULT);
|
syscall(::mlock2, ret, size, MLOCK_ONFAULT);
|
||||||
database::allocator::mlock_current += size;
|
database::allocator::mlock_current += size;
|
||||||
|
|
|
@ -297,6 +297,7 @@ struct ircd::db::database::allocator final
|
||||||
{
|
{
|
||||||
static const size_t ALIGN_DEFAULT;
|
static const size_t ALIGN_DEFAULT;
|
||||||
static const size_t mlock_limit;
|
static const size_t mlock_limit;
|
||||||
|
static const bool mlock_enabled;
|
||||||
static size_t mlock_current;
|
static size_t mlock_current;
|
||||||
static unsigned cache_arena;
|
static unsigned cache_arena;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue