summary refs log tree commit diff
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2023-06-22 11:37:48 +0300
committerGitHub <noreply@github.com>2023-06-22 11:37:48 +0300
commit920b833494926d9252833e951f460e6b595d48aa (patch)
tree078c30cf8bcf48f1696dbe8e9b276e4a81ce565f
parentf55321995c877e42e51e05572aab415c62856537 (diff)
parente1a6c85c2ba53933bfe5b6a86b9031cc28e4f9e1 (diff)
downloadnixpkgs-920b833494926d9252833e951f460e6b595d48aa.tar
nixpkgs-920b833494926d9252833e951f460e6b595d48aa.tar.gz
nixpkgs-920b833494926d9252833e951f460e6b595d48aa.tar.bz2
nixpkgs-920b833494926d9252833e951f460e6b595d48aa.tar.lz
nixpkgs-920b833494926d9252833e951f460e6b595d48aa.tar.xz
nixpkgs-920b833494926d9252833e951f460e6b595d48aa.tar.zst
nixpkgs-920b833494926d9252833e951f460e6b595d48aa.zip
Merge pull request #238459 from SuperSamus/vm.max_map_count
-rw-r--r--nixos/modules/config/malloc.nix1
-rw-r--r--nixos/modules/config/sysctl.nix3
-rw-r--r--nixos/modules/virtualisation/lxd.nix2
-rw-r--r--pkgs/applications/networking/browsers/firefox/common.nix1
4 files changed, 5 insertions, 2 deletions
diff --git a/nixos/modules/config/malloc.nix b/nixos/modules/config/malloc.nix
index ae0661f472f..043f78c8214 100644
--- a/nixos/modules/config/malloc.nix
+++ b/nixos/modules/config/malloc.nix
@@ -97,7 +97,6 @@ in
   };
 
   config = mkIf (cfg.provider != "libc") {
-    boot.kernel.sysctl."vm.max_map_count" = mkIf (cfg.provider == "graphene-hardened") (mkDefault 1048576);
     environment.etc."ld-nix.so.preload".text = ''
       ${providerLibPath}
     '';
diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix
index 4346c88f768..0bc7ab9667f 100644
--- a/nixos/modules/config/sysctl.nix
+++ b/nixos/modules/config/sysctl.nix
@@ -72,5 +72,8 @@ in
     # Disable YAMA by default to allow easy debugging.
     boot.kernel.sysctl."kernel.yama.ptrace_scope" = mkDefault 0;
 
+    # Improve compatibility with applications that allocate
+    # a lot of memory, like modern games
+    boot.kernel.sysctl."vm.max_map_count" = mkDefault 1048576;
   };
 }
diff --git a/nixos/modules/virtualisation/lxd.nix b/nixos/modules/virtualisation/lxd.nix
index c06716e5eb6..738382ef41a 100644
--- a/nixos/modules/virtualisation/lxd.nix
+++ b/nixos/modules/virtualisation/lxd.nix
@@ -177,7 +177,7 @@ in {
       "fs.inotify.max_queued_events" = 1048576;
       "fs.inotify.max_user_instances" = 1048576;
       "fs.inotify.max_user_watches" = 1048576;
-      "vm.max_map_count" = 262144;
+      "vm.max_map_count" = 262144; # TODO: Default vm.max_map_count has been increased system-wide
       "kernel.dmesg_restrict" = 1;
       "net.ipv4.neigh.default.gc_thresh3" = 8192;
       "net.ipv6.neigh.default.gc_thresh3" = 8192;
diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix
index 883c04a5a67..a062d767d13 100644
--- a/pkgs/applications/networking/browsers/firefox/common.nix
+++ b/pkgs/applications/networking/browsers/firefox/common.nix
@@ -371,6 +371,7 @@ buildStdenv.mkDerivation ({
     export MOZILLA_OFFICIAL=1
   '' + lib.optionalString stdenv.hostPlatform.isMusl ''
     # linking firefox hits the vm.max_map_count kernel limit with the default musl allocator
+    # TODO: Default vm.max_map_count has been increased, retest without this
     export LD_PRELOAD=${mimalloc}/lib/libmimalloc.so
   '';