Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp732685rwl; Thu, 5 Jan 2023 03:54:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXvNH4fDGwQ9zSbaVkG8rIA/AFOb7NEjQUFny81gYkk2liUue1u1kMOjmlI7Stf7ZUy2Pofi X-Received: by 2002:a17:902:f7d2:b0:192:6a00:5d08 with SMTP id h18-20020a170902f7d200b001926a005d08mr37679546plw.48.1672919676999; Thu, 05 Jan 2023 03:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672919676; cv=none; d=google.com; s=arc-20160816; b=Wxhs5hmPh0YoA7tLimp/iXRYufvLynk+miJateA/4tfYvNJkhgltpjP66FkhRuIJDT Kiw+fiZzlvLCE4QfmRvKsOwXVwmgGUWR3IsvtaTVDERnKhBQVpEjKpxEGYlwHrM86Ta2 9aIBoW5ALkx2pJJlF2L4d9G3TCy/beVXiplTdVrsYfwq2dhxFnMLTMUrhDIFwjoylG1W 3vgVgSq3joorC5fi3S4ipyEkSxNLwoI10fKZsfx7DfT6H++wjXxYoeVn/W0DN4Vb1SPL F4Eex/Nrg5gY5uA35JSnLwggf79hVqgfOs9hlUusnVgRsX01vIKbgw714ExDs2Ic7+4N Nu5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=3TzeClUmw2EXJ+Cj6InwkEP7+mw9g4PGAvklh0RHd2o=; b=g/5d8Tf1DBpvgumHJ9b68PthClXiduSEAb/tpwJjSag+PJrQczhhDCpKyijNt17LJv 2xNrYrbIQGdkGjAD0b+Kx0hjmkW+KzgypK1EwkPrf8yP2eT9ofMoNBxmlF6Af0fNtze5 VkL9HRAFdoctD6xrxRSBjKb2kP9dxOjt9wmGjZwqgMLHVR0BvbOIlK69/l7ftt76aGQG 9KP0GmnrxYmgD8gwhPZpbTnGpeqc192Nu+/TpKcYg9hbbF94cUU2nIXH2GsNlqhpfHed ZvXHiXlFmGTd1wOHNdRBcxE7J92FpATJqxPfZVDmpK6/Qjv9ggv3NJG/yzCcCQRNZAKN 0QGg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a170902e94c00b00192c9303df2si11537052pll.133.2023.01.05.03.54.29; Thu, 05 Jan 2023 03:54:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232626AbjAELdZ (ORCPT + 57 others); Thu, 5 Jan 2023 06:33:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231971AbjAELdX (ORCPT ); Thu, 5 Jan 2023 06:33:23 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D3C0D11A27 for ; Thu, 5 Jan 2023 03:33:21 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0520815BF; Thu, 5 Jan 2023 03:34:03 -0800 (PST) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B77283F663; Thu, 5 Jan 2023 03:33:17 -0800 (PST) Message-ID: <82689dd6-9db1-dd00-069b-73a637a21126@arm.com> Date: Thu, 5 Jan 2023 12:33:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [RFC PATCH v4 1/2] sched/fair: Introduce short duration task check Content-Language: en-US To: Chen Yu , Peter Zijlstra , Vincent Guittot , Tim Chen , Mel Gorman Cc: 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 References: From: Dietmar Eggemann In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 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. > + update_avg(&p->se.dur_avg, dur); > +} > + [...]