From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C884C47089 for ; Thu, 27 May 2021 13:37:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D601613AC for ; Thu, 27 May 2021 13:37:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236268AbhE0NjL (ORCPT ); Thu, 27 May 2021 09:39:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236394AbhE0NjG (ORCPT ); Thu, 27 May 2021 09:39:06 -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 54823C061574; Thu, 27 May 2021 06:37:31 -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=3bZ/LkqfBhJhawvK2heoarmGy4iJoc0yGvgh3vim5Nw=; b=FXZPg1F1fbulTYZ8znR1bssXMq dpYlRBnqpR0h7cS53Eg4LcmPAxiBL0BOOdoZR/Hiz5bBrsw29gzEadYLNwOSCoQPG8YcANlxcrASc OFmr82sMAAgEpMhlknstrfPqaci2qAi5oUPrA1wihuDgPJ0G2R2qWVwM954Rp6XhPgDQG4mLWqCZI sXKtxYdumvMRJcrDKkwKdI/kmbsx74dh9A61k2k1jILx4aTbhC8cBcqNgkAcB9M8bZhqlS6rBsL4q ZsQHBgz22fMF0GzFwpiHnPniApiedCiKYQFR7kAeM8PBYnO3NMEaHyC4wv0YeRm4d3S8IVSLoGHp3 13FhhmAA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmGCC-0010fO-86; Thu, 27 May 2021 13:37:15 +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 (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5DE8230022C; Thu, 27 May 2021 15:37:13 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3A5D0201DEF0D; Thu, 27 May 2021 15:37:13 +0200 (CEST) Date: Thu, 27 May 2021 15:37:13 +0200 From: Peter Zijlstra To: Vincent Guittot Cc: Ingo Molnar , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-kernel , Odin Ugedal , "open list:CONTROL GROUP (CGROUP)" Subject: Re: [PATCH 1/2] sched/fair: keep load_avg and load_sum synced Message-ID: References: <20210527122916.27683-1-vincent.guittot@linaro.org> <20210527122916.27683-2-vincent.guittot@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 27, 2021 at 03:18:35PM +0200, Vincent Guittot wrote: > > - delta_sum = load_sum - (s64)se_weight(se) * se->avg.load_sum; > > - delta_avg = load_avg - se->avg.load_avg; > > - > > se->avg.load_sum = runnable_sum; > > se->avg.load_avg = load_avg; > > - add_positive(&cfs_rq->avg.load_avg, delta_avg); > > - add_positive(&cfs_rq->avg.load_sum, delta_sum); > > + > > + add_positive(&cfs_rq->avg.load_avg, (long)(load_avg - se->avg.load_avg)); > > you have to keep: > delta_avg = load_avg - se->avg.load_avg > or move se->avg.load_avg = load_avg after > add_positive(&cfs_rq->avg.load_avg, ..); > because otherwise (load_avg - se->avg.load_avg) == 0 Duh. /me goes fix. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 1/2] sched/fair: keep load_avg and load_sum synced Date: Thu, 27 May 2021 15:37:13 +0200 Message-ID: References: <20210527122916.27683-1-vincent.guittot@linaro.org> <20210527122916.27683-2-vincent.guittot@linaro.org> Mime-Version: 1.0 Return-path: 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=3bZ/LkqfBhJhawvK2heoarmGy4iJoc0yGvgh3vim5Nw=; b=FXZPg1F1fbulTYZ8znR1bssXMq dpYlRBnqpR0h7cS53Eg4LcmPAxiBL0BOOdoZR/Hiz5bBrsw29gzEadYLNwOSCoQPG8YcANlxcrASc OFmr82sMAAgEpMhlknstrfPqaci2qAi5oUPrA1wihuDgPJ0G2R2qWVwM954Rp6XhPgDQG4mLWqCZI sXKtxYdumvMRJcrDKkwKdI/kmbsx74dh9A61k2k1jILx4aTbhC8cBcqNgkAcB9M8bZhqlS6rBsL4q ZsQHBgz22fMF0GzFwpiHnPniApiedCiKYQFR7kAeM8PBYnO3NMEaHyC4wv0YeRm4d3S8IVSLoGHp3 13FhhmAA==; Content-Disposition: inline In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Vincent Guittot Cc: Ingo Molnar , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-kernel , Odin Ugedal , "open list:CONTROL GROUP (CGROUP)" On Thu, May 27, 2021 at 03:18:35PM +0200, Vincent Guittot wrote: > > - delta_sum = load_sum - (s64)se_weight(se) * se->avg.load_sum; > > - delta_avg = load_avg - se->avg.load_avg; > > - > > se->avg.load_sum = runnable_sum; > > se->avg.load_avg = load_avg; > > - add_positive(&cfs_rq->avg.load_avg, delta_avg); > > - add_positive(&cfs_rq->avg.load_sum, delta_sum); > > + > > + add_positive(&cfs_rq->avg.load_avg, (long)(load_avg - se->avg.load_avg)); > > you have to keep: > delta_avg = load_avg - se->avg.load_avg > or move se->avg.load_avg = load_avg after > add_positive(&cfs_rq->avg.load_avg, ..); > because otherwise (load_avg - se->avg.load_avg) == 0 Duh. /me goes fix.