[ovs-dev] [PATCH] rhel: limit stack size to 2M.
Timothy Redaelli
tredaelli at redhat.com
Thu Feb 28 18:28:58 UTC 2019
On Thu, 28 Feb 2019 13:13:57 -0300
Flavio Leitner <fbl at sysclose.org> wrote:
> The default stack size in Fedora/RHEL is 8M, which means when ovs-vswitchd
> daemon starts and uses --mlockall (default), it will dirty all memory
> regions for all threads which is proportionally to the number of CPUs.
>
> On a big host this increases memory usage to many hundreds of megabytes
> while OVS actually requires much less.
>
> This patch relies on systemd to limit to 2M/thread. That is much more
> than the minimum documented at function ovs_thread_create():
>
> /* Some small systems use a default stack size as small as 80 kB, but OVS
> * requires approximately 384 kB according to the following analysis:
> * https://mail.openvswitch.org/pipermail/ovs-dev/2016-January/308592.html
> *
> * We use 512 kB to give us some margin of error. */
>
> Signed-off-by: Flavio Leitner <fbl at sysclose.org>
> ---
> rhel/usr_lib_systemd_system_ovs-vswitchd.service.in | 1 +
> 1 file changed, 1 insertion(+)
Without the patch:
# fgrep stack /proc/$(cat /var/run/openvswitch/ovs-vswitchd.pid)/limits
Max stack size 8388608 unlimited bytes
#
With the patch:
# fgrep stack /proc/$(cat /var/run/openvswitch/ovs-vswitchd.pid)/limits
Max stack size 2097152 2097152 bytes
#
Acked-By: Timothy Redaelli <tredaelli at redhat.com>
Tested-By: Timothy Redaelli <tredaelli at redhat.com>
More information about the dev
mailing list