aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralivshits <alivshits@yandex-team.ru>2022-02-10 16:51:43 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:51:43 +0300
commit653584b2d0be2bfbfad05b1d4c0cea95696eade9 (patch)
treeab7fbbf3253d4c0e2793218f09378908beb025fb
parent9a3354258cc740927a49f403277c5ada11712452 (diff)
downloadydb-653584b2d0be2bfbfad05b1d4c0cea95696eade9.tar.gz
Restoring authorship annotation for <alivshits@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--util/system/filemap.cpp20
-rw-r--r--util/system/mlock.cpp74
-rw-r--r--util/system/mlock.h24
3 files changed, 59 insertions, 59 deletions
diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp
index a170b6028e..7454a4cb94 100644
--- a/util/system/filemap.cpp
+++ b/util/system/filemap.cpp
@@ -297,7 +297,7 @@ public:
void Evict(void* ptr, size_t len) {
MadviseEvict(ptr, len);
}
-
+
void Evict() {
#if defined(_unix_)
// Evict(PtrStart_, Length_);
@@ -309,7 +309,7 @@ public:
if (Mapping_) {
::CloseHandle(Mapping_); // != FALSE
Mapping_ = nullptr;
- }
+ }
#elif defined(_unix_)
if (PtrStart_) {
munmap((caddr_t)PtrStart_, Length_);
@@ -411,14 +411,14 @@ void TMemoryMap::SetSequential() {
Impl_->SetSequential();
}
-void TMemoryMap::Evict(void* ptr, size_t len) {
- Impl_->Evict(ptr, len);
-}
-
-void TMemoryMap::Evict() {
- Impl_->Evict();
-}
-
+void TMemoryMap::Evict(void* ptr, size_t len) {
+ Impl_->Evict(ptr, len);
+}
+
+void TMemoryMap::Evict() {
+ Impl_->Evict();
+}
+
i64 TMemoryMap::Length() const noexcept {
return Impl_->Length();
}
diff --git a/util/system/mlock.cpp b/util/system/mlock.cpp
index 6d5cbe18da..435338c98f 100644
--- a/util/system/mlock.cpp
+++ b/util/system/mlock.cpp
@@ -1,10 +1,10 @@
-#include <util/generic/yexception.h>
-#include "align.h"
-#include "error.h"
-#include "info.h"
-#include "mlock.h"
-
-#if defined(_unix_)
+#include <util/generic/yexception.h>
+#include "align.h"
+#include "error.h"
+#include "info.h"
+#include "mlock.h"
+
+#if defined(_unix_)
#include <sys/mman.h>
#if !defined(MCL_ONFAULT) && defined(MCL_FUTURE) // Old glibc.
#define MCL_ONFAULT (MCL_FUTURE << 1)
@@ -13,45 +13,45 @@
#include <sys/syscall.h>
#define munlockall() syscall(__NR_munlockall)
#endif
-#else
+#else
#include "winint.h"
-#endif
-
+#endif
+
void LockMemory(const void* addr, size_t len) {
-#if defined(_unix_)
- const size_t pageSize = NSystemInfo::GetPageSize();
+#if defined(_unix_)
+ const size_t pageSize = NSystemInfo::GetPageSize();
if (mlock(AlignDown(addr, pageSize), AlignUp(len, pageSize))) {
ythrow yexception() << LastSystemErrorText();
}
-#elif defined(_win_)
- HANDLE hndl = GetCurrentProcess();
- SIZE_T min, max;
+#elif defined(_win_)
+ HANDLE hndl = GetCurrentProcess();
+ SIZE_T min, max;
if (!GetProcessWorkingSetSize(hndl, &min, &max))
- ythrow yexception() << LastSystemErrorText();
- if (!SetProcessWorkingSetSize(hndl, min + len, max + len))
- ythrow yexception() << LastSystemErrorText();
+ ythrow yexception() << LastSystemErrorText();
+ if (!SetProcessWorkingSetSize(hndl, min + len, max + len))
+ ythrow yexception() << LastSystemErrorText();
if (!VirtualLock((LPVOID)addr, len))
- ythrow yexception() << LastSystemErrorText();
-#endif
-}
-
+ ythrow yexception() << LastSystemErrorText();
+#endif
+}
+
void UnlockMemory(const void* addr, size_t len) {
-#if defined(_unix_)
+#if defined(_unix_)
if (munlock(addr, len)) {
- ythrow yexception() << LastSystemErrorText();
+ ythrow yexception() << LastSystemErrorText();
}
-#elif defined(_win_)
- HANDLE hndl = GetCurrentProcess();
- SIZE_T min, max;
+#elif defined(_win_)
+ HANDLE hndl = GetCurrentProcess();
+ SIZE_T min, max;
if (!GetProcessWorkingSetSize(hndl, &min, &max))
- ythrow yexception() << LastSystemErrorText();
- if (!SetProcessWorkingSetSize(hndl, min - len, max - len))
- ythrow yexception() << LastSystemErrorText();
+ ythrow yexception() << LastSystemErrorText();
+ if (!SetProcessWorkingSetSize(hndl, min - len, max - len))
+ ythrow yexception() << LastSystemErrorText();
if (!VirtualUnlock((LPVOID)addr, len))
- ythrow yexception() << LastSystemErrorText();
-#endif
-}
-
+ ythrow yexception() << LastSystemErrorText();
+#endif
+}
+
void LockAllMemory(ELockAllMemoryFlags flags) {
Y_UNUSED(flags);
#if defined(_android_)
@@ -80,7 +80,7 @@ void UnlockAllMemory() {
// unimplemented
#elif defined(_unix_)
if (munlockall()) {
- ythrow yexception() << LastSystemErrorText();
+ ythrow yexception() << LastSystemErrorText();
}
-#endif
-}
+#endif
+}
diff --git a/util/system/mlock.h b/util/system/mlock.h
index e401f27e4c..f021c0fe67 100644
--- a/util/system/mlock.h
+++ b/util/system/mlock.h
@@ -1,18 +1,18 @@
-#pragma once
-
-#include "defaults.h"
-
+#pragma once
+
+#include "defaults.h"
+
#include <util/generic/flags.h>
-//on some systems (not win, freebd, linux, but darwin (Mac OS X)
-//multiple mlock calls on the same address range
-//require the corresponding number of munlock calls to actually unlock the pages
-
-//on some systems you must have privilege and resource limit
-
+//on some systems (not win, freebd, linux, but darwin (Mac OS X)
+//multiple mlock calls on the same address range
+//require the corresponding number of munlock calls to actually unlock the pages
+
+//on some systems you must have privilege and resource limit
+
void LockMemory(const void* addr, size_t len);
void UnlockMemory(const void* addr, size_t len);
-
+
enum ELockAllMemoryFlag {
/** Lock all pages which are currently mapped into the address space of the process. */
LockCurrentMemory = 1,
@@ -40,4 +40,4 @@ void LockAllMemory(ELockAllMemoryFlags flags);
*
* Does nothing on windows.
*/
-void UnlockAllMemory();
+void UnlockAllMemory();