Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3945899rwb; Tue, 20 Sep 2022 06:57:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tjrbZXQxa+zwCN+Le0ViJNhP+kHv96CVTPXWLZv0NYBCa8xkrFF6yl/V4oseWIlBM2L/L X-Received: by 2002:a65:6c11:0:b0:439:ebfb:f8cb with SMTP id y17-20020a656c11000000b00439ebfbf8cbmr12640021pgu.6.1663682236293; Tue, 20 Sep 2022 06:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663682236; cv=none; d=google.com; s=arc-20160816; b=ENGHID4BiCgJWx+KTTkWPTiuGjm5oPFOLSXLSEPbN0fkMhKNsTZft3HLQten+xAqeC uOium49GaAik+3YrMLOvd1lE50FNHVq+FEZ2dHEBGZRobcY+5ulaTwEe813lZgrNI9NT CNUiqWTHvPBGZrGlruPX5byp2W4v2ZNOl3XSQyQMnc5l99yLvp72mzqUDuCQnz8P1Ba+ Acg842Xe+kQorsCRDqEQlvbrTt+PZl6Rw1wgZzA0yvm0/49bkNfoBmFElvrduDCrqBXA 8EIP9qjprBm7GCo8AGfcElsKR5hcY2+scOkP1A50t7+SILhGS3LWJZouqyix/FYG//dr oEMw== 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=SC4YYMe2iw9p2KI7QM9Vy8FK6MJQJQQmLTpPpmqx8mQ=; b=Q3F+ADC5IzZXwA/lsbLAu6LFSck4nCH/BE4XeWegrvibzI2ChLVA51coktJcgFskBr lSOAmJc5raKW0ioCxYcysi2yEDFN7jxTv2fVl0A3Tb9U39qXkunIPATGze/1r140fxwY YF0R4QhQAw802NBE4XzVJo2C4fuRJnkRYVev4V+abF+cJE47Cqnjxx02XTbhVaSqpFTe GeWR3rfQmBZwbbxfHSr5IJeYwLO/h6abo8ehLCyMjqOdE3VlCRDFMGLL34Y3h1B7YNsp TPLoP2rf8opS2t+Ttpr8u/EhDcw0nkZAEVWujO4BQPHXbqAkQDNB6HQB4CkWEld6m69h 6bJQ== 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 a27-20020a631a5b000000b00439246eabf1si1897204pgm.618.2022.09.20.06.57.03; Tue, 20 Sep 2022 06:57:16 -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 S230143AbiITNSm (ORCPT + 99 others); Tue, 20 Sep 2022 09:18:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230511AbiITNSg (ORCPT ); Tue, 20 Sep 2022 09:18:36 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 900ED21B3 for ; Tue, 20 Sep 2022 06:18:31 -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 937DD1042; Tue, 20 Sep 2022 06:18:37 -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 BFC173F73D; Tue, 20 Sep 2022 06:18:27 -0700 (PDT) Message-ID: Date: Tue, 20 Sep 2022 15:18:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v4 5/8] sched/fair: Take into account latency priority at wakeup Content-Language: en-US To: Vincent Guittot Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org, parth@linux.ibm.com, qais.yousef@arm.com, chris.hyser@oracle.com, valentin.schneider@arm.com, patrick.bellasi@matbug.net, David.Laight@aculab.com, pjt@google.com, pavel@ucw.cz, tj@kernel.org, qperret@google.com, tim.c.chen@linux.intel.com, joshdon@google.com References: <20220916080305.29574-1-vincent.guittot@linaro.org> <20220916080305.29574-6-vincent.guittot@linaro.org> <073938c4-ab23-2270-8e60-291f2901e230@arm.com> From: Dietmar Eggemann In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,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 19/09/2022 17:39, Vincent Guittot wrote: > On Mon, 19 Sept 2022 at 12:05, Dietmar Eggemann > wrote: >> >> On 16/09/2022 10:03, Vincent Guittot wrote: >> >> [...] >> >>> @@ -4512,7 +4519,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) >>> p->prio = current->normal_prio; >>> >>> /* Propagate the parent's latency requirements to the child as well */ >>> - p->latency_nice = current->latency_nice; >>> + p->latency_prio = current->latency_prio; >> >> Isn't here a `set_latency_offset(p)` missing here? > > Hmm, I think it's the opposite and the line above is a nop from the > beginning (i.e. patch 2). Yeah, you're right! It looked suspicious ... [...] >>> + * the idle thread and don't set next buddy as a candidate for being >>> + * picked in priority. >>> + * In case of simultaneous wakeup from idle, the latency sensitive tasks >>> + * lost opportunity to preempt non sensitive tasks which woke up >>> + * simultaneously. >>> + */ >> >> The position of this comment block within this function is somehow >> misleading since it describes the reason for the function rather then a >> particular condition within this function. Wouldn't it be more readable >> when it would be a function header comment instead? > > I put it after the usual early return tests to put the comment close > to the useful part: the use of next buddy and __pick_first_entity() So you want to have the `wakeup_preempt_entity(se, pse) == 1` condition from check_preempt_wakeup() also for cfs_task woken up by others. [...] >>> + * requirement that needs to be evaluated versus other entity. >>> + * Otherwise, use the latency weight to evaluate how much scheduling >>> + * delay is acceptable by se. >>> + */ >>> + if ((se->latency_offset < 0) || (curr->latency_offset < 0)) >>> + latency_offset -= curr->latency_offset; >> >> I still don't get the rationale behind why when either one (se or curr) >> of the latency_nice values is negative, we use the diff between them but >> if not, we only care about se's value. Why don't you always use the diff >> between se and curr? Since we have a range [-20 ... 19] why shouldn't we >> use the difference between let's say se = 19 and curr = 5? >> You discussed this with Tao Zhou on the v1 but I didn't understand it fully. > > Let say that current has a latency nice prio of 19 and a task A with a > latency nice of 10 wakes up. Both tasks don't care about scheduling > latency (current more than task A). If we use the diff, the output of > wakeup_latency_gran() would be negative (-10ms) which reflects the > fact that the waking task is sensitive to the latency and wants to > preempt current even if its vruntime is after. But obviously both > current and task A don't care to preempt at wakeup. OK, I understand but there is a certain level of unsteadiness here. If p has >0 it gets treated differently in case current has >=0 and case current has <0. Do we expect that tasks set their value to [1..19] in this case, when the default 0 already indicates a 'don't care'?