Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3061090rwb; Mon, 16 Jan 2023 03:14:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXvJ5gjMNK0Vk3vl69E8NxcdtxdVN1brKN/M4ZLdY6iBaVpCEYwC8DvxHSj8k81frx0vFsYR X-Received: by 2002:a17:90a:448c:b0:226:8d3:7ed6 with SMTP id t12-20020a17090a448c00b0022608d37ed6mr69721472pjg.41.1673867674541; Mon, 16 Jan 2023 03:14:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673867674; cv=none; d=google.com; s=arc-20160816; b=ZgUrfHZf5GkjYg4oAnlQKt88yh80k13I9/oEM/zTvyEbJenWZLQ19KYrKNo7L8TeOe /2uRO0w+LFaxB14SMOGHOJmNbDg4/VAR7ZHHYAvQlBMty8G2jfCwpaRO0IwI6Ae7/irq cY6ZtDEgDcDS2j/zOP1kfRxl1KbjIIlgVlHzjUcpWwQKGc0YKm83IAw/rEp04JoTvhxG MGeN+QHC+J0K7cG9ePz/8FgKhKrNCFtbXJXd0UJVAfJkK4/lrwNSND9XsSbDzo3EjR/W FA/FRGZpyfYfkC81wTSdDxBPJ456+cop0FIuzGaWZWE9RpLeEuhTzPPTkyMSIx3in8XJ aw2A== 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=MgQ9FPXfMxLwxsk75gwYk68V1T/CXWg4RyfCf7l9qgU=; b=L0+IeqhUt9p6HtGIDpBTCWRhqqyvPYqdSYgoSIfLBv/KE5OPw0ytWWzqQ/Ttr/o+Hv +4liq7/c4DTESGNLKJ8MpBNq7AIhvBc8SW9fvZXnllZvqU32WaPmcckA2gFENtd0fsWH ko45fq2IwH7iGxlR8TF+kuoecM8FOB1zxIPp59zZiCx6gcmuSMrs4mzYU5oDYHI4VK4V wkHQUjgtfJjNvxEU+9n1UPxDHgqQ0213Nf3B/dtxok83kKmar8X9dWMlGbD6S8Xu+CF9 ugg3yYaaBbMasSBbfdurG9qG/JsVJQcfQJIJGoo4mgXtHG5wA926YqtOutZfBqj40EwP 7xug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=iQOgFIqZ; 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 6-20020a630d46000000b00478d123064esi28520042pgn.401.2023.01.16.03.14.28; Mon, 16 Jan 2023 03:14:34 -0800 (PST) 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=casper.20170209 header.b=iQOgFIqZ; 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 S230318AbjAPKeq (ORCPT + 51 others); Mon, 16 Jan 2023 05:34:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230384AbjAPKec (ORCPT ); Mon, 16 Jan 2023 05:34:32 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E8AD1ABE5 for ; Mon, 16 Jan 2023 02:34:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=MgQ9FPXfMxLwxsk75gwYk68V1T/CXWg4RyfCf7l9qgU=; b=iQOgFIqZh0V/5D35t/qkSS9y2C r+hK+gz4WpRAbB+AtzHFcwHXGz6Ac3NS+hJydMh67XloEtibm18Ok8ceV5cl0+tJcKh7lQgdQ+Saz BlWpq+pSBJoP6dj0GH6MT1dpqRdlyFWlxg5fYwhfXmdsRKf6iSJrzv2vPQbHuCjXdlz81bPmcdnCo deCdfO3nJArbS6WMO78A/gv9bdmRtfO2/csqQha9Qs3ImlF6h2+S4oVPwhCWepSFsvWG6YWOvu7GN d1CNopgOWr0GfcwEUvfCz2FpIeH+yKcUjz7FBOxQ0dLTMrFeXagePX7vopN6nj8Y+g1Sj17LglsHV g/PdFPOw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHMoC-008eKr-8k; Mon, 16 Jan 2023 10:33:45 +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 A4F58300642; Mon, 16 Jan 2023 11:33:26 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8853420D30489; Mon, 16 Jan 2023 11:33:26 +0100 (CET) Date: Mon, 16 Jan 2023 11:33:26 +0100 From: Peter Zijlstra To: Dietmar Eggemann Cc: Chen Yu , Vincent Guittot , Tim Chen , Mel Gorman , Juri Lelli , Rik van Riel , Aaron Lu , Abel Wu , K Prateek Nayak , Yicong Yang , "Gautham R . Shenoy" , Ingo Molnar , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Valentin Schneider , Hillf Danton , Honglei Wang , Len Brown , Chen Yu , Tianchen Ding , Joel Fernandes , Josh Don , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v4 1/2] sched/fair: Introduce short duration task check Message-ID: References: <82689dd6-9db1-dd00-069b-73a637a21126@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <82689dd6-9db1-dd00-069b-73a637a21126@arm.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 Thu, Jan 05, 2023 at 12:33:16PM +0100, Dietmar Eggemann wrote: > On 16/12/2022 07:11, Chen Yu wrote: > > [...] > > > @@ -5995,6 +6005,18 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) > > > > static void set_next_buddy(struct sched_entity *se); > > > > +static inline void dur_avg_update(struct task_struct *p, bool task_sleep) > > +{ > > + u64 dur; > > + > > + if (!task_sleep) > > + return; > > + > > + dur = p->se.sum_exec_runtime - p->se.prev_sum_exec_runtime_vol; > > + p->se.prev_sum_exec_runtime_vol = p->se.sum_exec_runtime; > > Shouldn't se->prev_sum_exec_runtime_vol be set in enqueue_task_fair() > and not in dequeue_task_fair()->dur_avg_update()? Otherwise `dur` will > contain sleep time. > > Like we do for se->prev_sum_exec_runtime in set_next_entity() but for > one `set_next_entity()-put_prev_entity()` run section. > > AFAICS, you want to measure the exec_runtime sum over all run sections > between enqueue and dequeue. You were thinking of the dynamic PELT window size thread? (which is what I had to think of when I looked at this). I think we can still do that with this prev_sum_exec_runtime_vol (can't say I love the name though). At any point (assuming we update sum_exec_runtime) sum_exec_runtime - prev_sum_exec_runtime_vol is the duration of the current activation.