From patchwork Fri Aug 5 06:34:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 73342 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1769464qga; Thu, 4 Aug 2016 23:34:18 -0700 (PDT) X-Received: by 10.98.71.140 with SMTP id p12mr132951159pfi.93.1470378858194; Thu, 04 Aug 2016 23:34:18 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si18881446pfj.2.2016.08.04.23.34.17; Thu, 04 Aug 2016 23:34:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030448AbcHEGeO (ORCPT + 27 others); Fri, 5 Aug 2016 02:34:14 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34156 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752147AbcHEGeM (ORCPT ); Fri, 5 Aug 2016 02:34:12 -0400 Received: by mail-pa0-f48.google.com with SMTP id fi15so90141329pac.1 for ; Thu, 04 Aug 2016 23:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6zcdnG4smnTk7rmkQHjFGem1buIURDDD/qrjtZnH3eI=; b=HEtgLgRuIACsXmIz9CNTxfKah13P8kKBx4xSSWCp1cAlqps6PPE69VTrGeLAq/FhN9 jho3fk52wYK4FSOUi87CC1xEFfx9vg9wZZ9F6XY7W6E4jHY7GGqTZaoryf0BwpvrZ4nx 27cpCPU0+6oKj6AipJiOuXv9V9sV0U+HmfwUM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6zcdnG4smnTk7rmkQHjFGem1buIURDDD/qrjtZnH3eI=; b=MLQlP4DFUx4Jy6GKGXv396bS81ldvCttdqfHavUcoeGqHGRt68xyy//iS9oDAshZVQ tkRhCidR4RxazdDyxv2i/+xbYEHspTmyezkQeUR7UVyADhhazOtNT6dBtgK3RnmbXAhV XHBj1N4v3SrmiCA7RCSL/qkcF8uenDJC+pgNiMCfiNKroEiicwtFLNfhuLD1hO/kTpv5 SxendHU5x3lx7uDbrjNq/eBzMhsVEfu+/IPH7QyrFIjoPV/EEgRrN6iqjz8mDfV0GMDg NVj4XPpodwE7/r5TEooSEgAzyPiSc75UKEJZCMjQ7FEHOJ/qOob3BdEL0ZjY69HqWOxn jlPQ== X-Gm-Message-State: AEkoouvaI5VjaKH0iuUEZOdD207Qw8lTWGW34iSZNQJCYDMUfc9itZ4jkRUBJ5H/yXESB5jc X-Received: by 10.67.1.35 with SMTP id bd3mr133844763pad.16.1470378851540; Thu, 04 Aug 2016 23:34:11 -0700 (PDT) Received: from localhost.localdomain (61-216-91-114.HINET-IP.hinet.net. [61.216.91.114]) by smtp.gmail.com with ESMTPSA id fe8sm24930679pad.2.2016.08.04.23.34.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Aug 2016 23:34:10 -0700 (PDT) From: Leo Yan To: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH] sched/fair: refine maximum periods for decay_load Date: Fri, 5 Aug 2016 14:34:00 +0800 Message-Id: <1470378840-15206-1-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 will be decayed to zero. So this patch is to change maximum periods from 64 to 48. Signed-off-by: Leo Yan --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.9.1 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e342159..55cb134 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2622,7 +2622,7 @@ static __always_inline u64 decay_load(u64 val, u64 n) if (!n) return val; - else if (unlikely(n > LOAD_AVG_PERIOD * 63)) + else if (unlikely(n > LOAD_AVG_PERIOD * 47)) return 0; /* after bounds checking we can collapse to 32-bit */