Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5270431rwd; Mon, 5 Jun 2023 00:39:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5JxCeh36tYJ9k02ZqjaxngX0jtUBJ0bd6vemGqpcONWLgVRh+jFwyvXMnEun9wUocOyc1r X-Received: by 2002:aca:f10:0:b0:398:57ac:23fe with SMTP id 16-20020aca0f10000000b0039857ac23femr7434229oip.10.1685950755700; Mon, 05 Jun 2023 00:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685950755; cv=none; d=google.com; s=arc-20160816; b=Kx4mMPSUImbo+pazgtomMroIVlNBa3tr9gX4OPdv+OUxa8vFujaGWkJYsnpaW5gS8X Z3yI1O07QtKS+Ih3G31+vUa3NxREXAlMZoHPvFzObpqdWzHgJ9vOawEwKoS7LCyhB4tj dfI1A7o6JigQt3p/zxadcw6JUzauJdNcbHmBGxWIdEdX8gbTFqGzajBY8nBMPBnjcePI MYICj+BzCC0jpWxQlfhqyz/YcPAYEMQLTLUW0UmZ/y76ycxNsXwmibIHbnQMpD7Dzkm5 su+D/DxLvlf08p3H53DkrPvUq/c1HdYZzbD+3sBDM3IOC30ZLhQYllUMlRr01szQksSo CkpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=05RCd0BotypeJ3vpqjuiW1CsQvUl82c9ZsPvAfek+Xo=; b=kQ9JY2l+dLj2LIkCNe9aiW57h1nuJk0u9lmaN8Ht7ySWK3eE8NpBF6OKmLXNimZAno 3UWXH5FqAdgEIEk4XuOaN6n4qkVj6Cy4qnEojwA7Jxb+NLRTbkhadKvbBnFx10JZuiiC K0PYM1DjMBjBWGbgQPoc4M09nIzvIyr9r0FL1T1PkXW1JJMlW3kjJj44MIdauSv9+Kbx l/gcjCGIQFAJz9fwG2L75pc6qTyeh008fNLZV7DTsh4mcbtNOTsStdOcdmPO5Ox7bgM4 K+xDIPuHyZvj3RE7I54Mjwh/XvEVxcPiVOBjkl4h2YjGwamP+Z4d+WpC6RSKYt3kVGbq GGdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MBVqCRfW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a170902b94600b001aaf62c76cesi4970523pls.129.2023.06.05.00.39.03; Mon, 05 Jun 2023 00:39:15 -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=@linaro.org header.s=google header.b=MBVqCRfW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230453AbjFEHST (ORCPT + 99 others); Mon, 5 Jun 2023 03:18:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230064AbjFEHSS (ORCPT ); Mon, 5 Jun 2023 03:18:18 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2460AB7 for ; Mon, 5 Jun 2023 00:18:17 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id af79cd13be357-75ea05150b3so50074685a.0 for ; Mon, 05 Jun 2023 00:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685949496; x=1688541496; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=05RCd0BotypeJ3vpqjuiW1CsQvUl82c9ZsPvAfek+Xo=; b=MBVqCRfWsw6qQRPiraqaKf3iGTJzuD8MVEYkkholH2SfWxwluGMd3kmvPbgJZr/23+ l/GFYiuZ6mGYZV02PVAhnyRGrbU/S2rMbF3l8oYSX3sRB5hULdsdxU+CJ63kfIzafuvU //L+W2sEvbE2bTOvU3K1OBDa8+mNAjoBav3WcopiShAfhI9loZq2W3cZd+9glXYsuRUZ pxIIPRsG/V7zrvLack3DYQDZoAoM7eKE5AWrSmBVC8th92v1qUbCe+yvRBiVc661pHI1 f+3e7ZX8OQgcejuEIEHGv9h3uJKR3sXPafdoBVB9aMlRmN8B6HpPEhQcfp8DXOXWOakK d0oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685949496; x=1688541496; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=05RCd0BotypeJ3vpqjuiW1CsQvUl82c9ZsPvAfek+Xo=; b=cWmrCtDpbbMNd3Kp/frZUcCyd2qJv178rxqHoUwFo08Cq1ejVNz/tQ8PmhEZwe190E 40BuJwcRczFdrkhFJAzD8jNN7lrc98U4jJE0KW5fKmX80sPPjLYVJI71IXKnabcwlcfU vsXBOUOynFRtbqlcb0lM8TH8nYglvm9zP9BjC0oZUFt2zTXKwhx6/PikWNf3OPQflZYW ckIFPD4Ua5sbw2V5ozLtkH6wWc/9/1jJuNXEzMs3NB7kVkiPJYKIqu3vrkFXQ0HThAZJ azL/ZfUPmVUvN/O7mcpGX6RTPZvZSZbHprxBHjVkMeCxdab1MpEGweLaq6JflLx/xp3i b7tA== X-Gm-Message-State: AC+VfDyk9KGh20x9YhP6yPUd87SXDtlVCa1huVBVhzgGUL7lygfG71lM NiSR0jc6b5uaszrZW4ELnA9y2i2td3VsvMDA5X6GhA== X-Received: by 2002:a37:400b:0:b0:75b:23a1:8309 with SMTP id n11-20020a37400b000000b0075b23a18309mr16356109qka.4.1685949496255; Mon, 05 Jun 2023 00:18:16 -0700 (PDT) MIME-Version: 1.0 References: <20230531115839.089944915@infradead.org> <20230531124603.654144274@infradead.org> <20230602142739.GH620383@hirez.programming.kicks-ass.net> In-Reply-To: <20230602142739.GH620383@hirez.programming.kicks-ass.net> From: Vincent Guittot Date: Mon, 5 Jun 2023 09:18:05 +0200 Message-ID: Subject: Re: [PATCH 01/15] sched/fair: Add avg_vruntime To: Peter Zijlstra Cc: mingo@kernel.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, joshdon@google.com, timj@gnu.org, kprateek.nayak@amd.com, yu.c.chen@intel.com, youssefesmat@chromium.org, joel@joelfernandes.org, efault@gmx.de, tglx@linutronix.de Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Fri, 2 Jun 2023 at 16:27, Peter Zijlstra wrote: > > On Fri, Jun 02, 2023 at 03:51:53PM +0200, Vincent Guittot wrote: > > On Wed, 31 May 2023 at 14:47, Peter Zijlstra wrote: > > > +static void > > > +avg_vruntime_add(struct cfs_rq *cfs_rq, struct sched_entity *se) > > > +{ > > > + unsigned long weight = scale_load_down(se->load.weight); > > > + s64 key = entity_key(cfs_rq, se); > > > + > > > + cfs_rq->avg_vruntime += key * weight; > > > + cfs_rq->avg_load += weight; > > > > isn't cfs_rq->avg_load similar to scale_load_down(cfs_rq->load.weight) ? > > > > > +} > > Similar, yes, but not quite the same in two ways: > > - it's sometimes off by one entry due to ordering of operations -- this > is probably fixable. > > - it does the scale down after addition, whereas this does the scale > down before addition, esp for multiple low weight entries this makes > a significant difference. Ah yes, we are still using the the scaled down value for computation >