Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2171348rwn; Fri, 16 Sep 2022 06:44:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rh/o4xtMa4kveu4Vp0Mu84K/L30s6g+/ME1NBDypQyRRX/MVs7+ZZeIuFS2Ej/z9OW7bH X-Received: by 2002:a17:90b:4d82:b0:202:9030:e482 with SMTP id oj2-20020a17090b4d8200b002029030e482mr16927032pjb.110.1663335866974; Fri, 16 Sep 2022 06:44:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663335866; cv=none; d=google.com; s=arc-20160816; b=G1c5xtEroK+jFjVPGUNiNtp06Dt/DjeRBLHN6WrcWs8EWWpPRk6qB7r6bLCRduHtsJ eXxJOFqAO8R0BsG0ej0vqx8yTSVfyK2RjNkrjR5nJF5IwZ9R1dAdKJIWF4Ep8BZvgwOk lCFwDivISyN1hnCeDe9ISpIEIWdXoaVjLgHL+CnCXcWNCh2fsVuDIHB4GWNAyU3xLg8e oCZ5Hi9LshczEpm1WgP0/vERsFzJIGgUTmssUyVk1xJO9kBGIZ5Qc9VwkuMaJmX1Nn/f 6xJc7R4Vth4rxXC9xCpu3SI/p5Vm1vxTbl4ZW6K/JA1zpPdhxazmv5S8w6cOfef6aTz3 5f9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BNr579MPUpBlNB016dcpQJAUDBZMbLiiEVY+aFYhFJ0=; b=lLgdGCspf8UKXMSRN65XHxwnXBhyE/+CQBmTdexi2x+1+qacSId2V3AEE4ym9Xalru aHOYrmzdw6sObtg2xLnDNLv2jIv9KPkWjtw2i3hbfN3BEh4zj+UTNldXNx3fzsrBdNI6 XVj5cSOkoRgejeC1VFyCIMb6bbc8DLtYPaYPuOzasbyC154xrZvOJZyPPoC5HiKHGyBB SRwynlHmIll9XFLnXjSW46yVg4TN7tggRY/lmoNXY47qUwJWBW+OHWapZ5eHfkyB7Sdh poPj2x7cKyE5gsV1sUYXLnMvyUywYFakJTbubvTTPlhE6Cp15QNA7cr39HBbUMWq+Ate aqww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uz4sGI+1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p20-20020a63c154000000b0043934d930e4si13775670pgi.297.2022.09.16.06.44.15; Fri, 16 Sep 2022 06:44:26 -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; dkim=pass header.i=@linaro.org header.s=google header.b=uz4sGI+1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231596AbiIPNhK (ORCPT + 99 others); Fri, 16 Sep 2022 09:37:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbiIPNhI (ORCPT ); Fri, 16 Sep 2022 09:37:08 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B21E4AC255 for ; Fri, 16 Sep 2022 06:37:06 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id p5so26026143ljc.13 for ; Fri, 16 Sep 2022 06:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=BNr579MPUpBlNB016dcpQJAUDBZMbLiiEVY+aFYhFJ0=; b=uz4sGI+1uL8AisIcwfRejIBgxha5ufOJQG2c8ni9YHCRRKwl8D1MClt+J7wzDAM9Cx ZdbSyhIfJnrK/ih20efRtNeWD7Lq+Pr9yOY9ZeYarWfRphPSFvwiNLxXDvaEEuYUNl1J 5XkCVAWKPjtCGrRaG4EFuGX3iBkS85FI06eHkACDYxScys5bxA8MA8YHUKTtWnbayLhl gw86kxjUm57ES2Wx3byANyKxqorfi/E5xTDQc3qPVGXPJIeChCcdlBiupYUlL2bkBJWh /7mc638dbkRaodna5svrDs+lOgEVrFPBVCpHZOIQWHL5lXxSMBMRqg5aY/DxA6uDdSVm KoJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=BNr579MPUpBlNB016dcpQJAUDBZMbLiiEVY+aFYhFJ0=; b=oG01ukbR8rchgyH26DYwnK2hvMdsQrSn9qKagR47Vl+N7nG/qc2Vk++Oh5tMGEYIw4 l7OnXGwy9TXd00fqNzZgXpL5bmYB3xUyril1DpEJoQF39YSGBaw2oyENFWSTOtVXslKF o5Bbq6INKO1qA4jgL0q7U/Zvr30vk5s29lFkyeJMFvQGPefnupgNdIzdKb+kRlzY4iFm IFiIAe2J1x3l44TT2abDSWFjLhu0PrXq4kxUORfntTwfGWJSsl9kPi0jJ4yUFJMhxLTb LXPU65GMT7Np9uu0M01u4HlDIQ6Q2UCayfxGF5obKgiN6GLeTEo6I7Wt9kRKOx7H9XBi eZ5Q== X-Gm-Message-State: ACrzQf2xdTvC08xfN5Z03UI2jX0l9Bmu+GSZtnne62cE69U7y/LKlDS4 JxksOtpcUG7A4PFzR+H5eU5eUkciKUeky9oBPMsw3Q== X-Received: by 2002:a2e:bf01:0:b0:25f:df1a:f39d with SMTP id c1-20020a2ebf01000000b0025fdf1af39dmr1565245ljr.365.1663335424982; Fri, 16 Sep 2022 06:37:04 -0700 (PDT) MIME-Version: 1.0 References: <20220916080305.29574-6-vincent.guittot@linaro.org> <20220916120245.2951-1-hdanton@sina.com> In-Reply-To: <20220916120245.2951-1-hdanton@sina.com> From: Vincent Guittot Date: Fri, 16 Sep 2022 15:36:53 +0200 Message-ID: Subject: Re: [PATCH v4 5/8] sched/fair: Take into account latency priority at wakeup To: Hillf Danton Cc: peterz@infradead.org, mgorman@suse.de, valentin.schneider@arm.com, parth@linux.ibm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 Hi Hillf, On Fri, 16 Sept 2022 at 14:03, Hillf Danton wrote: > > Hello Vincent > > On 16 Sep 2022 10:03:02 +0200 Vincent Guittot wrote: > > > > @@ -4606,6 +4608,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) > > > > se = __pick_first_entity(cfs_rq); > > delta = curr->vruntime - se->vruntime; > > + delta -= wakeup_latency_gran(curr, se); > > > > if (delta < 0) > > return; > > What is derived from the latency nice you added is the runtime granulaity > which has a role in preempting the current task. > > Given the same defination of latency nice as the nice, the runtime granularity > can be computed without introducing the latency nice. > > Only for thoughts now. > > Hillf > > +++ b/kernel/sched/fair.c > @@ -4569,7 +4569,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, st > static void > check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) > { > - unsigned long ideal_runtime, delta_exec; > + unsigned long ideal_runtime, delta_exec, granu; > struct sched_entity *se; > s64 delta; > > @@ -4594,6 +4594,14 @@ check_preempt_tick(struct cfs_rq *cfs_rq > return; > > se = __pick_first_entity(cfs_rq); > + > + granu = sysctl_sched_min_granularity + > + (ideal_runtime - sysctl_sched_min_granularity) * > + (se->latency_nice + 20) / LATENCY_NICE_WIDTH; There is no latency_nice field in se but a latency_offset instead Also at this step, we are sure that curr has run at least sysctl_sched_min_granularity and we want now to compare curr vruntime with first se's one. We take the latency offset into account to make sure we will not preempt curr too early > + > + if (delta_exec < granu) > + return; > + > delta = curr->vruntime - se->vruntime; > > if (delta < 0)