Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp398609ybk; Fri, 15 May 2020 03:45:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwpZ+D8r6LEzIAqQHzf6jvgyW5W1gM8N0U0Qi9ZhDrPlRo6l6aSMvn4lWFqsmC6bNtpYbl X-Received: by 2002:a50:cb8a:: with SMTP id k10mr2144703edi.345.1589539550053; Fri, 15 May 2020 03:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589539550; cv=none; d=google.com; s=arc-20160816; b=dJ7Fa1IRoSHWwU/XLwhlauUVX3jPKQtjpashW6GgLS+19DolQUg/LY2viLd6ymv5Nn n+AJHku3FMwpx/5jG8s+gZ0UQ5oQ8kagsQyNNBQQzaVxyrhA2lnrSxKX/tySoQRlCZWJ ajC1xf8Am2mZoZa11BaX9YJqBvVXF2QVhRSscykSsW53LcMho8Wweb/O0ZNESdXMXQkF +w5cmh1QD9f2wsPfwdYCvJlhHz9diptkQFJ/zLxGumDhn0e5yyHCNBO309UcBpq9jW56 mgpSjOAyNwDreaXEG1nk6qtGKOiPTOgO24wgxCHLaL5EDMM8w4mEee87Ty9iCrEoCnvY b8SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bM9kPsQD3QhczF+TG8quv1SXMYXI3f/2x7Gd8UUdmys=; b=Xlp5GTI1gGIthUyiFHvh173+xaqr05EhzMBJhDhxB0Dv9v3Xz4srkSGizSAALUPZXb GMEZuVpwAVxBUlBZexLGV8emKoGoza31o42HvJAe5lrEPIBcrXBA5OIktHB0NstyPfaJ ZXhbe+Ermmg4I6fPS7WYnLpFEArI2KvwtsbfLjZ8nQupjKdAqAjJjHSDXwCvOIIb7ZFE Gw+fhmKnhz2j/sASq3mzGBR6HufgKhjk7aemFKfgSn2wtfyS1cWYPSJmNrr0keBqg6jz JjcgMhrFMd7/FmAzYaTzRQellZ8HLMFjDjRN7l15+oURz574JVAQmfpQLzA14X+tcIJ+ ogfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=lhpXQU0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si931126ejb.294.2020.05.15.03.45.25; Fri, 15 May 2020 03:45:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=lhpXQU0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728179AbgEOKns (ORCPT + 99 others); Fri, 15 May 2020 06:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728081AbgEOKnr (ORCPT ); Fri, 15 May 2020 06:43:47 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2014AC061A0C for ; Fri, 15 May 2020 03:43:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bM9kPsQD3QhczF+TG8quv1SXMYXI3f/2x7Gd8UUdmys=; b=lhpXQU0w3FI+AiS3XlETYitOkP X1O+Ey1QRYqIAByVDYnrB3LBH6W8IRoqevhVjNCFZAeiKavigV5Y0OfqXQ+hlCAYNjSk9ZoKNrWj6 PAukiRCmnWRmAYeUxgmzFqVYYA1M2nAp2zwegp71V8bU3uEv+2q6HQw2CktEn161QzSpWhyrlb1pM kw4Bhekc1WCD/7YFaOGqJZvkpKoqh91v1NU66dSgY0/9gNpgbfRr/YtCYbVdJICjr2fFt7Baapd/T NaUvk8JiUVnxjMCtsaRo8T2FA2RE3oW07Okdu8YnVwJa1/XIX+D56Kf4Tc1oCv3JnybWrJbWegHkN woekvOGQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jZXoD-00057h-O1; Fri, 15 May 2020 10:43:17 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9FF35300455; Fri, 15 May 2020 12:43:14 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7F5C620267E65; Fri, 15 May 2020 12:43:14 +0200 (CEST) Date: Fri, 15 May 2020 12:43:14 +0200 From: Peter Zijlstra To: Vineeth Remanan Pillai Cc: Aaron Lu , Nishanth Aravamudan , Julien Desfossez , Tim Chen , Ingo Molnar , Thomas Gleixner , Paul Turner , Linus Torvalds , Aaron Lu , Linux List Kernel Mailing , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Kees Cook , Greg Kerr , Phil Auld , Aubrey Li , "Li, Aubrey" , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , Joel Fernandes , Joel Fernandes Subject: Re: [PATCH updated v2] sched/fair: core wide cfs task priority comparison Message-ID: <20200515104314.GI3001@hirez.programming.kicks-ass.net> References: <20200421025131.GA227300@aaronlu-desktop> <20200424142443.GA263207@aaronlu-desktop> <20200506143506.GH5298@hirez.programming.kicks-ass.net> <20200508084419.GA120223@aaronlu-desktop> <20200508090925.GV5298@hirez.programming.kicks-ass.net> <20200508123457.GA122180@aaronlu-desktop> <20200514130248.GD2940@hirez.programming.kicks-ass.net> <20200515103844.GG2978@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200515103844.GG2978@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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