mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Merge pull request #31033 from azat/remap-log
Log size of remapped memory (remap_executable)
This commit is contained in:
commit
14a3988f8c
@ -595,8 +595,8 @@ if (ThreadFuzzer::instance().isEffective())
|
||||
if (config().getBool("remap_executable", false))
|
||||
{
|
||||
LOG_DEBUG(log, "Will remap executable in memory.");
|
||||
remapExecutable();
|
||||
LOG_DEBUG(log, "The code in memory has been successfully remapped.");
|
||||
size_t size = remapExecutable();
|
||||
LOG_DEBUG(log, "The code ({}) in memory has been successfully remapped.", ReadableSize(size));
|
||||
}
|
||||
|
||||
if (config().getBool("mlock_executable", false))
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include "remapExecutable.h"
|
||||
|
||||
#if defined(__linux__) && defined(__amd64__) && defined(__SSE2__) && !defined(SANITIZER) && defined(NDEBUG) && !defined(SPLIT_SHARED_LIBRARIES)
|
||||
|
||||
#include <sys/mman.h>
|
||||
@ -11,8 +13,6 @@
|
||||
#include <Common/Exception.h>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "remapExecutable.h"
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -136,10 +136,11 @@ __attribute__((__noinline__)) void remapToHugeStep1(void * begin, size_t size)
|
||||
}
|
||||
|
||||
|
||||
void remapExecutable()
|
||||
size_t remapExecutable()
|
||||
{
|
||||
auto [begin, size] = getMappedArea(reinterpret_cast<void *>(remapExecutable));
|
||||
remapToHugeStep1(begin, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
}
|
||||
@ -149,7 +150,7 @@ void remapExecutable()
|
||||
namespace DB
|
||||
{
|
||||
|
||||
void remapExecutable() {}
|
||||
size_t remapExecutable() { return 0; }
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/// This function tries to reallocate the code of the running program in a more efficient way.
|
||||
void remapExecutable();
|
||||
/// @return size of remapped area.
|
||||
size_t remapExecutable();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user