File 0382-erts-set-quota-to-1-if-cpu-quota-is-less-than-1.patch of Package erlang

From 06503d27abbcd17ab6fb1ca39334651c085ea80e Mon Sep 17 00:00:00 2001
From: Tony Han <h.bing612@gmail.com>
Date: Wed, 10 Jun 2020 15:15:31 +0800
Subject: [PATCH] erts: set quota to 1 if cpu quota is less than 1

---
 erts/lib_src/common/erl_misc_utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c
index 37394220f2..17506b87ef 100644
--- a/erts/lib_src/common/erl_misc_utils.c
+++ b/erts/lib_src/common/erl_misc_utils.c
@@ -1216,6 +1216,9 @@ read_cpu_quota(int limit)
             if (cfs_period_us > 0 && cfs_quota_us > 0) {
                 size_t quota = cfs_quota_us / cfs_period_us;
 
+                if (quota == 0) {
+                    quota = 1;
+                }
                 if (quota > 0 && quota <= (size_t)limit) {
                     return quota;
                 }
-- 
2.26.2

openSUSE Build Service is sponsored by