mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Paul Turner <pjt@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH] sched/fair: fix calc_cfs_shares fixed point arithmetics
Date: Wed, 11 Jan 2017 11:29:47 +0000	[thread overview]
Message-ID: <e9a4d858-bcf3-36b9-e3a9-449953e34569@arm.com> (raw)
In-Reply-To: <20161220131557.GN3124@twins.programming.kicks-ass.net>



On 20/12/16 13:15, Peter Zijlstra wrote:
> On Tue, Dec 20, 2016 at 02:04:34PM +0100, Dietmar Eggemann wrote:
>> Hi Samuel,
>>
>> On 12/20/2016 12:45 AM, Samuel Thibault wrote:
>>> Paul Turner, on Mon 19 Dec 2016 15:32:15 -0800, wrote:
>>>> On Mon, Dec 19, 2016 at 3:29 PM, Samuel Thibault
>>>> <samuel.thibault@ens-lyon.org> wrote:
>>>>> Paul Turner, on Mon 19 Dec 2016 15:26:19 -0800, wrote:
>>
>> [...]
>>
>>>> The MIN_SHARES you are seeing here is overloaded.
>>>> In the unscaled case this needs to be MIN_SHARES, and in the scaled
>>>> case, the subdivision of the scaled values must still be >=2.
>>>
>>> Ok, now I understand.  I have to say this overloading is confusing.
>>>
>>> Samuel
>>
>> this had been already discussed back in August when I posted the original
>> patch.
> 
> Maybe we should put a comment in to avoid getting more of these ;-)
> 

Maybe something like this? Mainly what Paul taught us plus an example from
a discussion I had with Vincent.

-- >8 --

Subject: [PATCH] sched/fair: Explain why MIN_SHARES isn't scaled in
 calc_cfs_shares()

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
---
 kernel/sched/fair.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6559d197e08a..a0ca9b11b1b3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2657,6 +2657,18 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg)
        if (tg_weight)
                shares /= tg_weight;
 
+       /*
+        * MIN_SHARES has to be unscaled here to support per-cpu partitioning
+        * of a group with small tg->shares value. It is a floor value which is
+        * assigned as a minimum load.weight to the sched_entity representing
+        * the group on a cpu.
+        *
+        * E.g. on 64-bit for a group with tg->shares of scale_load(15)=15*1024
+        * on an 8 core system with 8 tasks each runnable on one cpu shares has
+        * to be 15*1024*1/8=1920 instead of scale_load(MIN_SHARES)=2*1024. In
+        * case no task is runnable on a cpu MIN_SHARES=2 should be returned
+        * instead of 0.
+        */
        if (shares < MIN_SHARES)
                shares = MIN_SHARES;
        if (shares > tg->shares)
-- 
2.11.0

  reply	other threads:[~2017-01-11 11:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 22:40 Samuel Thibault
2016-12-19 22:44 ` Paul Turner
2016-12-19 23:07   ` Samuel Thibault
2016-12-19 23:26     ` Paul Turner
2016-12-19 23:29       ` Samuel Thibault
2016-12-19 23:32         ` Paul Turner
2016-12-19 23:45           ` Samuel Thibault
2016-12-20 13:04             ` Dietmar Eggemann
2016-12-20 13:15               ` Peter Zijlstra
2017-01-11 11:29                 ` Dietmar Eggemann [this message]
2017-01-14 12:48                   ` [tip:sched/core] sched/fair: Explain why MIN_SHARES isn't scaled in calc_cfs_shares() tip-bot for Dietmar Eggemann
2016-12-20 13:22               ` [PATCH] sched/fair: fix calc_cfs_shares fixed point arithmetics Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9a4d858-bcf3-36b9-e3a9-449953e34569@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@kernel.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®