From patchwork Mon Aug 22 14:00:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 74428 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1584493qga; Mon, 22 Aug 2016 07:00:57 -0700 (PDT) X-Received: by 10.98.9.11 with SMTP id e11mr43174493pfd.153.1471874457406; Mon, 22 Aug 2016 07:00:57 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i63si22945355pfe.3.2016.08.22.07.00.55; Mon, 22 Aug 2016 07:00:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755470AbcHVOAw (ORCPT + 27 others); Mon, 22 Aug 2016 10:00:52 -0400 Received: from foss.arm.com ([217.140.101.70]:53039 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754732AbcHVOAu (ORCPT ); Mon, 22 Aug 2016 10:00:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A7F823C; Mon, 22 Aug 2016 07:02:26 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2BC073F215; Mon, 22 Aug 2016 07:00:48 -0700 (PDT) From: Dietmar Eggemann To: Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH] sched/fair: Fix fixed point arithmetic width for shares and effective load Date: Mon, 22 Aug 2016 15:00:41 +0100 Message-Id: <1471874441-24701-1-git-send-email-dietmar.eggemann@arm.com> 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 Since commit 2159197d6677 ("sched/core: Enable increased load resolution on 64-bit kernels") we now have two different fixed point units for load. shares in calc_cfs_shares() has 20 bit fixed point unit on 64-bit kernels. Therefore use scale_load() on MIN_SHARES. wl in effective_load() has 10 bit fixed point unit. Therefore use scale_load_down() on tg->shares which has 20 bit fixed point unit on 64-bit kernels. Signed-off-by: Dietmar Eggemann --- Besides the issue with load_above_capacity when it comes to different fixed point units for load "[PATCH] sched/fair: Fix load_above_capacity fixed point arithmetic width" there are similar issues for shares in calc_cfs_shares() as well as wl in effective_load(). kernel/sched/fair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 1.9.1 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 61d485421bed..18f80c4c7737 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2530,8 +2530,8 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) if (tg_weight) shares /= tg_weight; - if (shares < MIN_SHARES) - shares = MIN_SHARES; + if (shares < scale_load(MIN_SHARES)) + shares = scale_load(MIN_SHARES); if (shares > tg->shares) shares = tg->shares; @@ -5023,9 +5023,9 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg) * wl = S * s'_i; see (2) */ if (W > 0 && w < W) - wl = (w * (long)tg->shares) / W; + wl = (w * (long)scale_load_down(tg->shares)) / W; else - wl = tg->shares; + wl = scale_load_down(tg->shares); /* * Per the above, wl is the new se->load.weight value; since