Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457176

[PATCH v2] sched/fair: refine maximum periods for decay_load

From Leo Yan <leo.yan@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v2] sched/fair: refine maximum periods for decay_load
Date 2016-08-05 17:50 +0200
Message-ID <s2PxL-YZ-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


In current code, decay_load() will consider to set load value to zero
after passing 32*64 ms. So this means max_load * (0.5^64) ~= 0.

Kernel can support maximum number of processes and threads to 2^29 and
set task with highest priority with nice=-20 (weight = 88761). So in
worst case, one CPU may have maximum load value is:

    max_load = 2^29 * 88761 < 2^46

In theory after pass 46 periods we can ensure load value to be decayed
to zero. So this patch is to change maximum periods from 64 to 46.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 kernel/sched/fair.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e342159..bbd01eb 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2622,7 +2622,15 @@ static __always_inline u64 decay_load(u64 val, u64 n)
 
 	if (!n)
 		return val;
-	else if (unlikely(n > LOAD_AVG_PERIOD * 63))
+	/*
+	 * Kernel can support maximum number of processes and threads up to
+	 * 2^29 and task has highest weight 88761 with nice=-20.
+	 *
+	 *     maximum load = 2^29 * 88761 < 2^46
+	 *
+	 * So pass 46 periods can ensure maximum load to be decayed to zero.
+	 */
+	else if (unlikely(n >= LOAD_AVG_PERIOD * 46))
 		return 0;
 
 	/* after bounds checking we can collapse to 32-bit */
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2] sched/fair: refine maximum periods for decay_load Leo Yan <leo.yan@linaro.org> - 2016-08-05 17:50 +0200

csiph-web