Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp289193rwl; Wed, 29 Mar 2023 01:38:42 -0700 (PDT) X-Google-Smtp-Source: AKy350bOWN9eObZinWD5CEW+EGPDadtV3sxgmbCsi58qohKBXq4XJG/FYkLw6bpFH+u8JNN0tHL1 X-Received: by 2002:a17:907:6d0b:b0:930:9cec:2fb9 with SMTP id sa11-20020a1709076d0b00b009309cec2fb9mr21141581ejc.77.1680079122436; Wed, 29 Mar 2023 01:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680079122; cv=none; d=google.com; s=arc-20160816; b=flWtcodtRvmdyraugu3vVQ8VVL75L3oMLH9bVvwxJGMgEPuHw+oSmxd5qGj1MC6Kyi bcX9D/07ulpkDmqy4rQ34p/WfVUaNpt39P6tpvBMeHIHkLzt2SSzq0vpCR1jY0tmdNIA +v4YGvuKEhWJiBKyTEWmR8q/xjA/Qc08ovVlVey3KILl7sXOxd4v8DGF+HLDwo6PBvXC oqnS5v0IQ25uEHwYaU6N2ts1guygAoWeZiOEcUDohexO+ePuUhw80u8+ZodSssRn8NBJ OTCC4hYrD25HVqonEVdMKNUtEdttUXLyJVaYEzRNVTu0ZVQSipgnb6o0UcWx2TVmTPr/ /EdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nTIJlxppJIAd74PmqdXD5+j2Dw+VegQUjf44O0/+rS0=; b=zz+WdDD46jI93YY5p6Wb5jmaA1Zfo8nqsHaL9mrII+yeGowY6Ct1i4ashQ2oIC0B9t /bliZKUFvzo49hIyCEEr3/Em2ibYk9znTxHj7hmGnL0ckHSQc++Wxu/ZSmgySMKbo7nK GWLaQdPb7iogP8nnHddiPjeZeJAdu+JBI3tO9ulzXjxUbGfYT9u1zp012k+hrzhe3GLC 3P96S+jszwmCPee3i4+X3pq1NJzsL1DGrbm4HKJZ9o3vxTeox6r4nrwFX3XHQD19IUDp fPDDJO5leNr70W19jAkvZUyNgpByTCZoVe58Ks0UbHmqK1PyiPLhR6quAQkKR+puGRHO 2jyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Z76hMZJa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id zc15-20020a170906988f00b00932835201fesi31972521ejb.635.2023.03.29.01.38.18; Wed, 29 Mar 2023 01:38:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Z76hMZJa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230480AbjC2IY1 (ORCPT + 99 others); Wed, 29 Mar 2023 04:24:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbjC2IYL (ORCPT ); Wed, 29 Mar 2023 04:24:11 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFF6A59FA for ; Wed, 29 Mar 2023 01:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=nTIJlxppJIAd74PmqdXD5+j2Dw+VegQUjf44O0/+rS0=; b=Z76hMZJagOEcvpbshbhpoxS/yy XFBO9YxpGQikJzgwRKO8U4dAesBwLF4Lc6r4qFZ3hgxXpCx5l5B5CMe/XSOT3s2aa2Osee4rYLMAp aQt+l45Rx77lLOZub51fibyssVu1bYB95GMYQV/U5qsGrk+Mq01R94XvmDfNO9vrPPq4r5HeHq5ZM zDmfx8X94Je5eIYMrLUnVGRicE116K0EEhQZ8fPJc1afy+rDdiVFMjbkEB5YQNni+Ce8D21VziFeY AYEnsSzTthQnjFtz8tDfMPkE92oHyHLPo75uCXnI42JN/quJTWT0rZG/Fix7FINnBoG8U+XkVJ+li 4czwBqTA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1phR4n-006nnB-16; Wed, 29 Mar 2023 08:22:37 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DA3B4300237; Wed, 29 Mar 2023 10:22:35 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BFEEF201D9959; Wed, 29 Mar 2023 10:22:35 +0200 (CEST) Date: Wed, 29 Mar 2023 10:22:35 +0200 From: Peter Zijlstra To: Josh Don Cc: mingo@kernel.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, corbet@lwn.net, qyousef@layalina.io, chris.hyser@oracle.com, patrick.bellasi@matbug.net, pjt@google.com, pavel@ucw.cz, qperret@google.com, tim.c.chen@linux.intel.com, timj@gnu.org, kprateek.nayak@amd.com, yu.c.chen@intel.com, youssefesmat@chromium.org, joel@joelfernandes.org, efault@gmx.de Subject: Re: [PATCH 08/17] sched/fair: Implement an EEVDF like policy Message-ID: <20230329082235.GA38236@hirez.programming.kicks-ass.net> References: <20230328092622.062917921@infradead.org> <20230328110354.141543852@infradead.org> <20230329080646.GL4253@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230329080646.GL4253@hirez.programming.kicks-ass.net> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 29, 2023 at 10:06:46AM +0200, Peter Zijlstra wrote: > On Tue, Mar 28, 2023 at 06:26:51PM -0700, Josh Don wrote: > > > +static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq) > > > +{ > > > + struct rb_node *node = cfs_rq->tasks_timeline.rb_root.rb_node; > > > + struct sched_entity *curr = cfs_rq->curr; > > > + struct sched_entity *best = NULL; > > > + > > > + if (curr && (!curr->on_rq || !entity_eligible(cfs_rq, curr))) > > > + curr = NULL; > > > + > > > + while (node) { > > > + struct sched_entity *se = __node_2_se(node); > > > + > > > + /* > > > + * If this entity is not eligible, try the left subtree. > > > + */ > > > + if (!entity_eligible(cfs_rq, se)) { > > > + node = node->rb_left; > > > + continue; > > > + } > > > + > > > + /* > > > + * If this entity has an earlier deadline than the previous > > > + * best, take this one. If it also has the earliest deadline > > > + * of its subtree, we're done. > > > + */ > > > + if (!best || deadline_gt(deadline, best, se)) { > > > + best = se; > > > + if (best->deadline == best->min_deadline) > > > + break; > > > > Isn't it possible to have a child with less vruntime (ie. rb->left) > > but with the same deadline? Wouldn't it be preferable to choose the > > child instead since the deadlines are equivalent but the child has > > received less service time? > > Possible, yes I suppose. But given this is ns granular virtual time, > somewhat unlikely. You can modify the last (validation) patch and have > it detect the case, see if you can trigger it. > > Doing that will make the pick always do a full decent of the tree > through, which is a little more expensive. Not sure it's worth the > effort. Hmm, maybe not, if there is no smaller-or-equal deadline then the min_deadline of the child will be greater and we can terminate the decent right there.