Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5404756pxb; Mon, 28 Mar 2022 12:02:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuxvjhfwpLdpZm+5Cx0lXB5Cb47ObM8IWX+UBkb/TfvUc+8WOmeRdffZ971xXy3HyBSraY X-Received: by 2002:a05:6402:2342:b0:419:e86:c7d5 with SMTP id r2-20020a056402234200b004190e86c7d5mr18217458eda.92.1648494122095; Mon, 28 Mar 2022 12:02:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648494122; cv=none; d=google.com; s=arc-20160816; b=PFS08DivRVkapZb4EHVJSnVdz/yN3rt66BOfR/I2yhEUcXRFky0hZoD6iBbaEuvF5K IIST0Hood1Yjfbad92h+bm6tG9PK4uvb0FYhu8gx+oQ7zByZF5BeKSU20vetyM+6lMmK FkshMPXo6g+rlhKUrlEYB/E8RBbN4jYCKCv6xAZRUV2IuPohleZJblYrWRZdijMvopxt keTGzujY9e5rpZjtTfNsO03wGM5Q1C7hddYzNm/3U6DOUTBG/FijflyZ3sskCEhGHncQ /gmvti5ztJirXyt1DkuyqhwxOVJctUGpzg/UwITiQ6fQ8a57u+R78ttmLj9z8Mv5US2H VJnA== 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=t7ZzMGy6Ql1vEZJYTnG647es+/GXs2wygi814NbGld0=; b=jyTIwjyd8LtquVV1kU2j9b0AzujTH9ireCdU1THdVlODrmcDrzIA228e/9WtgVDrQf TEekZdC9XxevgTz1nZ3rwuPgaT6igjqS+5MXJ8NfizlCB9EiXSBwJ4kI6o5nzRDLJHkF vxTgqkhAd+2XKwfGKPSNQgLWWKm+L+RqOejQtFh3hmkVqREkse9Firomprw9ApDYiUaa 10V8Y74xFRDMvRRfDzURXBjcbRlBnxn9csFE7DWrFpDObbwCSxmaHntWT2SprifZmx9Z ZZYTXHGXOqyxlF3CbDV+CPUsGuIfdJv0tNIwGi3TGBSQVg0e7lZSETiIkWuetP2ZehZH oX5w== 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 x23-20020a170906149700b006df76385ebbsi13947501ejc.859.2022.03.28.12.01.31; Mon, 28 Mar 2022 12:02:02 -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; 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 S239785AbiC1JZ4 (ORCPT + 99 others); Mon, 28 Mar 2022 05:25:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239780AbiC1JZy (ORCPT ); Mon, 28 Mar 2022 05:25:54 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EF67513FB7 for ; Mon, 28 Mar 2022 02:24:13 -0700 (PDT) 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 A4A7C1480; Mon, 28 Mar 2022 02:24:13 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8CCCB3F66F; Mon, 28 Mar 2022 02:24:10 -0700 (PDT) Message-ID: Date: Mon, 28 Mar 2022 11:24:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [RFC 5/6] sched/fair: Take into account latency nice at wakeup Content-Language: en-US To: Vincent Guittot , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org, parth@linux.ibm.com Cc: qais.yousef@arm.com, chris.hyser@oracle.com, pkondeti@codeaurora.org, valentin.schneider@arm.com, patrick.bellasi@matbug.net, David.Laight@aculab.com, pjt@google.com, pavel@ucw.cz, tj@kernel.org, dhaval.giani@oracle.com, qperret@google.com, tim.c.chen@linux.intel.com References: <20220311161406.23497-1-vincent.guittot@linaro.org> <20220311161406.23497-6-vincent.guittot@linaro.org> From: Dietmar Eggemann In-Reply-To: <20220311161406.23497-6-vincent.guittot@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,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 11/03/2022 17:14, Vincent Guittot wrote: [...] > @@ -4412,7 +4417,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) > p->prio = p->normal_prio = p->static_prio; > set_load_weight(p, false); > > - p->latency_nice = DEFAULT_LATENCY_NICE; > + p->latency_prio = NICE_TO_LATENCY(0); > /* > * We don't need the reset flag anymore after the fork. It has > * fulfilled its duty: > @@ -4420,6 +4425,9 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) > p->sched_reset_on_fork = 0; > } > > + /* Once latency_prio is set, update the latency weight */ > + set_latency_weight(p); I thought we only have to do this in the `sched_reset_on_fork` case? Like we do with set_load_weight(). Can we not rely on dup_task_struct() in the other case? [...] > @@ -5648,6 +5677,9 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) > if (!task_new) > update_overutilized_status(rq); > > + if (rq->curr == rq->idle) > + check_preempt_from_idle(cfs_rq_of(&p->se), &p->se); This is done here (1) because check_preempt_wakeup() (2) is only called if p and rq->curr have CFS sched class? ttwu_do_activate() activate_task() enqueue_task <-- (1) ttwu_do_wakeup() check_preempt_curr() if (p->sched_class == rq->curr->sched_class) rq->curr->sched_class->check_preempt_curr() <-- (2) [...] > @@ -7008,6 +7059,10 @@ static int > wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se) > { > s64 gran, vdiff = curr->vruntime - se->vruntime; > + int latency_weight = se->latency_weight - curr->latency_weight; > + > + latency_weight = min(latency_weight, se->latency_weight); Why the min out of latency_weight_diff(se, curr) and se->latency_weight here? [...]