aboutsummaryrefslogtreecommitdiff
path: root/platform-listen.c
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2025-04-09 14:48:56 +0000
committerEd Maste <emaste@FreeBSD.org>2025-04-09 19:45:50 +0000
commit9792a032f0a99557271d6b7f7b0a955386c1fdbe (patch)
treefffe2fb734d6754ae63284d06db6bef8bb091a84 /platform-listen.c
parentde47678f9822eb19289056cce942a43a29e28c06 (diff)
Diffstat (limited to 'platform-listen.c')
-rw-r--r--platform-listen.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/platform-listen.c b/platform-listen.c
index 42c4040f0c81..45df1f6c36c9 100644
--- a/platform-listen.c
+++ b/platform-listen.c
@@ -34,6 +34,13 @@ platform_pre_listen(void)
/* Adjust out-of-memory killer so listening process is not killed */
oom_adjust_setup();
#endif
+#ifdef LINUX_MEMLOCK_ONFAULT
+ /*
+ * Protect ourselves against kcompactd so that we are able to process
+ * new connections while it is active and migrating pages.
+ */
+ memlock_onfault_setup();
+#endif
}
void
@@ -82,3 +89,13 @@ platform_post_fork_child(void)
#endif
}
+void platform_pre_session_start(void)
+{
+#ifdef LINUX_MEMLOCK_ONFAULT
+ /*
+ * Memlock flags are dropped on fork, lock the memory again so that the
+ * child connection is also protected against kcompactd.
+ */
+ memlock_onfault_setup();
+#endif
+}