Skip to content

Commit 4c3a67c

Browse files
committed
add option "populate_io_buffers"
1 parent 5b5facd commit 4c3a67c

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

debian/changelog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cm4all-myproxy (0.30) unstable; urgency=low
22

3+
* add option "populate_io_buffers"
34
* fix build with glibc 2.43
45

56
--

doc/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ means they must not do any network I/O, launch child processes, and
6969
should avoid anything but querying the parameters.
7070

7171

72+
Global Variables
73+
^^^^^^^^^^^^^^^^
74+
75+
- ``populate_io_buffers``: ``true`` populates all I/O buffers on
76+
startup. This reduces waits for Linux kernel VM
77+
compaction/migration.
78+
79+
7280
Control Listener
7381
----------------
7482

src/Main.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "lua/io/CgroupInfo.hxx"
2424
#include "lib/fmt/RuntimeError.hxx"
2525
#include "lib/fmt/SystemError.hxx"
26+
#include "memory/SlicePool.hxx"
2627
#include "net/AllocatedSocketAddress.hxx"
2728
#include "net/LocalSocketAddress.hxx"
2829
#include "net/Parser.hxx"
@@ -81,6 +82,15 @@ IsSystemdMagic(lua_State *L, int idx)
8182

8283
#endif // HAVE_LIBSYSTEMD
8384

85+
static bool
86+
GetGlobalBool(lua_State *L, const char *name)
87+
{
88+
lua_getglobal(L, name);
89+
AtScopeExit(L) { lua_pop(L, 1); };
90+
91+
return lua_toboolean(L, -1);
92+
}
93+
8494
static auto
8595
ParameterToLuaHandler(lua_State *L, int idx)
8696
try {
@@ -291,6 +301,9 @@ try {
291301
return EX_CONFIG;
292302
}
293303

304+
if (GetGlobalBool(instance.GetLuaState(), "populate_io_buffers"))
305+
fb_pool_get().Populate();
306+
294307
SetupRuntimeState(instance.GetLuaState());
295308

296309
#ifdef HAVE_LIBSYSTEMD

0 commit comments

Comments
 (0)