[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200515104314.GI3001@hirez.programming.kicks-ass.net>
Date: Fri, 15 May 2020 12:43:14 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Vineeth Remanan Pillai <vpillai@...italocean.com>
Cc: Aaron Lu <aaron.lwe@...il.com>,
Nishanth Aravamudan <naravamudan@...italocean.com>,
Julien Desfossez <jdesfossez@...italocean.com>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Paul Turner <pjt@...gle.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Aaron Lu <aaron.lu@...ux.alibaba.com>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
Frédéric Weisbecker <fweisbec@...il.com>,
Kees Cook <keescook@...omium.org>,
Greg Kerr <kerrnel@...gle.com>, Phil Auld <pauld@...hat.com>,
Aubrey Li <aubrey.intel@...il.com>,
"Li, Aubrey" <aubrey.li@...ux.intel.com>,
Valentin Schneider <valentin.schneider@....com>,
Mel Gorman <mgorman@...hsingularity.net>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Joel Fernandes <joelaf@...gle.com>,
Joel Fernandes <joel@...lfernandes.org>
Subject: Re: [PATCH updated v2] sched/fair: core wide cfs task priority
comparison
On Fri, May 15, 2020 at 12:38:44PM +0200, Peter Zijlstra wrote:
> less := !((s64)(s_a - s_b) <= 0)
>
> (v_a - S_a) - (v_b - S_b) == v_a - v_b - S_a + S_b
> == v_a - (v_b - S_a + S_b)
>
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -469,7 +469,7 @@ bool cfs_prio_less(struct task_struct *a
> {
> struct sched_entity *se_a = &a->se, *se_b = &b->se;
> struct cfs_rq *cfs_rq_a, *cfa_rq_b;
> - u64 vruntime_a, vruntime_b;
> + u64 s_a, s_b, S_a, S_b;
>
> while (!is_same_tg(se_a, se_b)) {
> int se_a_depth = se_a->depth;
> @@ -484,10 +484,16 @@ bool cfs_prio_less(struct task_struct *a
> cfs_rq_a = cfs_rq_of(se_a);
> cfs_rq_b = cfs_rq_of(se_b);
>
> - vruntime_a = se_a->vruntime - cfs_rq_a->core_vruntime;
> - vruntime_b = se_b->vruntime - cfs_rq_b->core_vruntime;
> + S_a = cfs_rq_a->core_vruntime;
> + S_b = cfs_rq_b->core_vruntime;
>
> - return !((s64)(vruntime_a - vruntime_b) <= 0);
> + if (cfs_rq_a == cfs_rq_b)
> + S_a = S_b = cfs_rq_a->min_vruntime;
> +
> + s_a = se_a->vruntime - S_a;
> + s_b = se_b->vruntime - S_b;
> +
> + return !((s64)(s_a - s_b) <= 0);
> }
Clearly I'm not awake yet; 's/s_/l_/g', 's/v_/s_/g', IOW:
l_a = s_a - S_a
Powered by blists - more mailing lists