Skip to content

Commit

Permalink
Adjust default process/threads limit
Browse files Browse the repository at this point in the history
When VM is started with memory hotplug, the initial memory size is quite
small. It is used for calculating default threads limit, and that in
turns is used to calculate default process count limit per user. For a
VM started with 400MB (the default) both limits are too low for some
threads/processes-heavy applications like Firefox.

Adjust the limits to a static higher value, based on defaults when
memory hotplug is disabled (and rounded to a nice number).

Fixes QubesOS/qubes-issues#8960

(cherry picked from commit cefe875)
  • Loading branch information
marmarek committed Nov 5, 2024
1 parent e8084cb commit 3310d24
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions debian/qubes-core-agent.install
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ etc/qubes/rpc-config/qubes.VMExecGUI
etc/qubes/suspend-post.d/README
etc/qubes/suspend-post.d/*.sh
etc/qubes/suspend-pre.d/README
etc/security/limits.d/90-qubes-core.conf
etc/sudoers.d/qt_x11_no_mitshm
etc/sudoers.d/umask
etc/sysctl.d/20_tcp_timestamps.conf
Expand Down Expand Up @@ -106,6 +107,7 @@ lib/systemd/system/sysinit.target.d/30_qubes.conf
lib/systemd/system/systemd-timesyncd.service.d/30_qubes.conf
lib/systemd/system/systemd-logind.service.d/30_qubes.conf
lib/systemd/resolved.conf.d/30_resolved-no-mdns-or-llmnr.conf
usr/lib/sysctl.d/20-qubes-core.conf
usr/lib/systemd/user/tracker-extract-3.service.d/30_qubes.conf
usr/lib/systemd/user/tracker-miner-fs-3.service.d/30_qubes.conf
usr/lib/systemd/user/tracker-miner-fs-control-3.service.d/30_qubes.conf
Expand Down
5 changes: 5 additions & 0 deletions misc/20-qubes-core.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# With memory hotplug enabled, default value is calculated based on the initial
# memory, and is too low for some heavy multi-threads applications like
# Firefox. Raise the limit

kernel.threads-max = 51200
5 changes: 5 additions & 0 deletions misc/90-qubes-core.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# With memory hotplug enabled, default value is calculated based on the initial
# memory, and is too low (below 1000) for some heavy multi-threads applications
# like Firefox. Raise the limit
@qubes hard nproc 51200
@qubes soft nproc 51200
2 changes: 2 additions & 0 deletions misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ install:
install -m 0755 -d $(DESTDIR)/etc/xdg/xfce4/xfconf/xfce-perchannel-xml
install -m 0644 -t $(DESTDIR)/etc/xdg/xfce4/xfconf/xfce-perchannel-xml xfce4-notifyd.xml
install -m 0644 -t $(DESTDIR)/etc/xdg/xfce4/xfconf/xfce-perchannel-xml displays.xml
install -m 0644 -D -t $(DESTDIR)/etc/security/limits.d 90-qubes-core.conf
install -m 0644 -D -t $(DESTDIR)/usr/lib/sysctl.d 20-qubes-core.conf

marker-vm: marker-vm.in
printf "$(VERSION)" | cut -f 1,2 -d . | cat $< - > marker-vm
2 changes: 2 additions & 0 deletions rpm_spec/core-agent.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,8 @@ rm -f %{name}-%{version}
%config(noreplace) /etc/dconf/db/local.d/dpi
%config(noreplace) /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-notifyd.xml
%config(noreplace) /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/displays.xml
%config(noreplace) /etc/security/limits.d/90-qubes-core.conf
/usr/lib/sysctl.d/20-qubes-core.conf
%_udevrulesdir/50-qubes-mem-hotplug.rules
%_unitdir/[email protected]/90-session-stop-timeout.conf
/usr/sbin/qubes-serial-login
Expand Down

0 comments on commit 3310d24

Please sign in to comment.