aboutsummaryrefslogtreecommitdiffstats
path: root/vespamalloc
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-06-29 10:47:39 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-06-29 10:47:39 +0000
commitb2bcbb4807896b14ef34a41efa2054cc2a90a9ab (patch)
tree46d81fd599a48bbedc1ae5d6f56111601f39fa46 /vespamalloc
parentd6d03eff698a549ef46372e5b8e07be2be84d448 (diff)
GC atnomem_loglevel and atinvalid_loglevel
Diffstat (limited to 'vespamalloc')
-rw-r--r--vespamalloc/etc/vespamalloc.conf2
-rw-r--r--vespamalloc/src/vespamalloc/malloc/datasegment.h6
-rw-r--r--vespamalloc/src/vespamalloc/malloc/datasegment.hpp3
-rw-r--r--vespamalloc/src/vespamalloc/malloc/malloc.h13
-rw-r--r--vespamalloc/src/vespamalloc/malloc/memorywatcher.h38
5 files changed, 20 insertions, 42 deletions
diff --git a/vespamalloc/etc/vespamalloc.conf b/vespamalloc/etc/vespamalloc.conf
index c7b20a170b5..c2b79061ea5 100644
--- a/vespamalloc/etc/vespamalloc.conf
+++ b/vespamalloc/etc/vespamalloc.conf
@@ -24,6 +24,4 @@ bigblocklimit 0x80000000 # default(0x800000) Limit for when to log ne
pralloc_loglimit 0x7fffffffffffffff # What to log pr alloc. default(0x7fffffffffffffff) except mallocdst(0x200000). mallocdst_nl(0x7fffffffffffffff), but has effect on SIGHUP.
#Some deprecated/less usefull ones.
-atnomem_loglevel 2 # default(1) Loglevel used when datasegment is exhausted.
-atinvalid_loglevel 2 # default(1) Loglevel used when vespa_malloc discovers logical error.
allocs2show 0 # Number of allocations to show when dumping stacktrace.
diff --git a/vespamalloc/src/vespamalloc/malloc/datasegment.h b/vespamalloc/src/vespamalloc/malloc/datasegment.h
index 5c1c1f06088..3bd87ca343f 100644
--- a/vespamalloc/src/vespamalloc/malloc/datasegment.h
+++ b/vespamalloc/src/vespamalloc/malloc/datasegment.h
@@ -30,11 +30,8 @@ public:
size_t textSize() const { return size_t(start()); }
size_t infoThread(FILE * os, int level, uint32_t thread, SizeClassT sct, uint32_t maxThreadId=0) const __attribute__((noinline));
void info(FILE * os, size_t level) __attribute__((noinline));
- void setupLog(size_t noMemLogLevel, size_t bigMemLogLevel,
- size_t bigLimit, size_t bigIncrement,
- size_t allocs2Show)
+ void setupLog(size_t bigMemLogLevel, size_t bigLimit, size_t bigIncrement, size_t allocs2Show)
{
- _noMemLogLevel = noMemLogLevel;
_bigSegmentLogLevel = bigMemLogLevel;
if ((size_t(end()) < _nextLogLimit) || (size_t(end()) < (size_t(start()) + bigLimit))) {
_nextLogLimit = size_t(start()) + bigLimit;
@@ -114,7 +111,6 @@ private:
typedef BlockT BlockList[BlockCount];
typedef FreeListT<BlockCount/2> FreeList;
OSMemory _osMemory;
- size_t _noMemLogLevel;
size_t _bigSegmentLogLevel;
size_t _bigIncrement;
size_t _allocs2Show;
diff --git a/vespamalloc/src/vespamalloc/malloc/datasegment.hpp b/vespamalloc/src/vespamalloc/malloc/datasegment.hpp
index 355c9e9daad..3fb56c6feb3 100644
--- a/vespamalloc/src/vespamalloc/malloc/datasegment.hpp
+++ b/vespamalloc/src/vespamalloc/malloc/datasegment.hpp
@@ -13,7 +13,6 @@ DataSegment<MemBlockPtrT>::~DataSegment() = default;
template<typename MemBlockPtrT>
DataSegment<MemBlockPtrT>::DataSegment() :
_osMemory(BlockSize),
- _noMemLogLevel(1),
_bigSegmentLogLevel(0),
_bigIncrement (0x4000000),
_allocs2Show (8),
@@ -98,8 +97,6 @@ void * DataSegment<MemBlockPtrT>::getBlock(size_t & oldBlockSize, SizeClassT sc)
if (recurse++ == 0) {
perror("Failed extending datasegment: ");
assert(false);
- MemBlockPtrT::dumpInfo(_noMemLogLevel);
- sleep(2);
}
return nullptr;
}
diff --git a/vespamalloc/src/vespamalloc/malloc/malloc.h b/vespamalloc/src/vespamalloc/malloc/malloc.h
index 5ea71d9ea47..e6330e7e55f 100644
--- a/vespamalloc/src/vespamalloc/malloc/malloc.h
+++ b/vespamalloc/src/vespamalloc/malloc/malloc.h
@@ -53,16 +53,11 @@ public:
void info(FILE * os, size_t level=0) __attribute__ ((noinline));
- void setupSegmentLog(size_t noMemLogLevel,
- size_t bigMemLogLevel,
- size_t bigLimit,
- size_t bigIncrement,
- size_t allocs2Show)
+ void setupSegmentLog(size_t bigMemLogLevel, size_t bigLimit, size_t bigIncrement, size_t allocs2Show)
{
- _segment.setupLog(noMemLogLevel, bigMemLogLevel, bigLimit, bigIncrement, allocs2Show);
+ _segment.setupLog(bigMemLogLevel, bigLimit, bigIncrement, allocs2Show);
}
- void setupLog(size_t invalidMem, size_t prAllocLimit) {
- _invalidMemLogLevel = invalidMem;
+ void setupLog(size_t prAllocLimit) {
_prAllocLimit = prAllocLimit;
}
void setParams(size_t alwayReuseLimit, size_t threadCacheLimit) {
@@ -75,7 +70,6 @@ private:
void crash() __attribute__((noinline));;
typedef AllocPoolT<MemBlockPtrT> AllocPool;
typedef typename ThreadListT::ThreadPool ThreadPool;
- size_t _invalidMemLogLevel;
size_t _prAllocLimit;
DataSegment<MemBlockPtrT> _segment;
AllocPool _allocPool;
@@ -85,7 +79,6 @@ private:
template <typename MemBlockPtrT, typename ThreadListT>
MemoryManager<MemBlockPtrT, ThreadListT>::MemoryManager(size_t logLimitAtStart) :
IAllocator(),
- _invalidMemLogLevel(1),
_prAllocLimit(logLimitAtStart),
_segment(),
_allocPool(_segment),
diff --git a/vespamalloc/src/vespamalloc/malloc/memorywatcher.h b/vespamalloc/src/vespamalloc/malloc/memorywatcher.h
index b992f4b264f..333291c5394 100644
--- a/vespamalloc/src/vespamalloc/malloc/memorywatcher.h
+++ b/vespamalloc/src/vespamalloc/malloc/memorywatcher.h
@@ -43,7 +43,7 @@ private:
const char * valueName() const { return _valueName; }
const char * value() const { return _value; }
void value(const char * v) __attribute__((noinline));
- long valueAsLong() const __attribute__((noinline)) { return strtol(_value, NULL, 0); }
+ long valueAsLong() const __attribute__((noinline)) { return strtol(_value, nullptr, 0); }
void info(FILE * os) __attribute__ ((noinline)) {
fprintf(os, "%s = %s %ld", valueName(), value(), valueAsLong());
}
@@ -60,8 +60,6 @@ private:
sigprof_loglevel,
atend_loglevel,
pralloc_loglimit,
- atnomem_loglevel,
- atinvalid_loglevel,
bigsegment_loglevel,
bigsegment_limit,
bigsegment_increment,
@@ -124,8 +122,6 @@ MemoryWatcher<T, S>::Params::Params()
_params[ sigprof_loglevel] = NameValuePair("sigprof_loglevel", "1");
_params[ atend_loglevel] = NameValuePair("atend_loglevel", "1");
_params[ pralloc_loglimit] = NameValuePair("pralloc_loglimit", "0x2000000");
- _params[ atnomem_loglevel] = NameValuePair("atnomem_loglevel", "1");
- _params[ atinvalid_loglevel] = NameValuePair("atinvalid_loglevel", "1");
_params[ bigsegment_loglevel] = NameValuePair("bigsegment_loglevel", "1");
_params[ bigsegment_limit] = NameValuePair("bigsegment_limit", "0x1000000000"); // 64GM
_params[ bigsegment_increment] = NameValuePair("bigsegment_increment", "0x100000000"); //4GM
@@ -197,7 +193,7 @@ bool MemoryWatcher<T, S>::activateLogFile(const char *logfile)
if ((oldFp != stderr) && (oldFp != stdout)) {
fclose(oldFp);
}
- return (_logFile != NULL);
+ return (_logFile != nullptr);
}
template <typename T, typename S>
@@ -205,13 +201,11 @@ void MemoryWatcher<T, S>::activateOptions()
{
activateLogFile(_params[Params::logfile].value());
T::dumpFile(_logFile);
- this->setupSegmentLog(_params[Params::atnomem_loglevel].valueAsLong(),
- _params[Params::bigsegment_loglevel].valueAsLong(),
- _params[Params::bigsegment_limit].valueAsLong(),
- _params[Params::bigsegment_increment].valueAsLong(),
- _params[Params::allocs2show].valueAsLong());
- this->setupLog(_params[Params::atinvalid_loglevel].valueAsLong(),
- _params[Params::pralloc_loglimit].valueAsLong());
+ this->setupSegmentLog(_params[Params::bigsegment_loglevel].valueAsLong(),
+ _params[Params::bigsegment_limit].valueAsLong(),
+ _params[Params::bigsegment_increment].valueAsLong(),
+ _params[Params::allocs2show].valueAsLong());
+ this->setupLog(_params[Params::pralloc_loglimit].valueAsLong());
this->setParams(_params[Params::alwaysreuselimit].valueAsLong(),
_params[Params::threadcachelimit].valueAsLong());
T::bigBlockLimit(_params[Params::bigblocklimit].valueAsLong());
@@ -226,7 +220,7 @@ const char *vespaHomeConf(char pathName[])
const char *home = "/opt/vespa";
const char *conf = "/etc/vespamalloc.conf";
const char *env = getenv("VESPA_HOME");
- if (env != NULL) {
+ if (env != nullptr) {
home = env;
}
if ((strlen(home) + strlen(conf)) >= PATH_MAX) {
@@ -276,21 +270,21 @@ void MemoryWatcher<T, S>::parseOptions(char * options)
{
bool isComment(false);
const char ignore('\0');
- const char *valueName(NULL);
- const char *value(NULL);
+ const char *valueName(nullptr);
+ const char *value(nullptr);
bool isWhite(true);
for(char *p=options; *p; p++) {
char c(*p);
if (c == '\n') {
- if ((valueName != NULL) && (value != NULL)) {
+ if ((valueName != nullptr) && (value != nullptr)) {
if (_params.update(valueName, value) == false) {
fprintf(stderr, "Invalid parameter %s", valueName);
}
}
isComment = false;
isWhite = true;
- valueName = NULL;
- value = NULL;
+ valueName = nullptr;
+ value = nullptr;
} else if (isComment) {
*p = ignore;
} else if (c == '#') {
@@ -299,7 +293,7 @@ void MemoryWatcher<T, S>::parseOptions(char * options)
} else {
if (isWhite) {
if (!isspace(c)) {
- if (valueName == NULL) {
+ if (valueName == nullptr) {
valueName = p;
} else {
value = p;
@@ -344,7 +338,7 @@ void MemoryWatcher<T, S>::signalHandler(int signum, siginfo_t * sig, void * arg
if (_params[Params::sigprof_loglevel].valueAsLong() > 1) {
fprintf(_logFile, "SignalHandler %d done\n", signum);
}
- if ((_oldSig.sa_handler != SIG_IGN) && (_oldSig.sa_handler != SIG_DFL) && (_oldSig.sa_handler != NULL)) {
+ if ((_oldSig.sa_handler != SIG_IGN) && (_oldSig.sa_handler != SIG_DFL) && (_oldSig.sa_handler != nullptr)) {
(_oldSig.sa_sigaction)(signum, sig, arg);
}
}
@@ -374,7 +368,7 @@ bool MemoryWatcher<T, S>::signal(int signum)
}
template <typename T, typename S>
-MemoryWatcher<T, S> * MemoryWatcher<T, S>::_manager = NULL;
+MemoryWatcher<T, S> * MemoryWatcher<T, S>::_manager = nullptr;
} // namespace vespamalloc