Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp518608ybk; Wed, 13 May 2020 06:15:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1vzEnfPOaY0jPBjiAPlWLNLMjyZGjOyBQ2rq9XM8to9x8lsA88JKK9+6sq18xGxpHOXLO X-Received: by 2002:a17:906:edd5:: with SMTP id sb21mr12125687ejb.204.1589375714623; Wed, 13 May 2020 06:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589375714; cv=none; d=google.com; s=arc-20160816; b=RUyWYpsJHSxYU/Bex8fOlZneIaR2t1763LKJ1CzIxJu4hLht2xYujOBRRam11NrOEr En13mgasDAeb+I/ba7Y0A7J0922IoCFIBg8oYXVm9N5qXELtm2wLNq+osCXd2JguZRJ1 6PxOwySc8PmP58xDyHXiguXJo7NYJlT2+V3JfOfPReEZFxiX4GH2UJ0nlMZcgwn/6oyr w5d8W0Pl64Ol5t2AJginmEiXBepVTVBApOzfhmYXEhntGii9g3TtezgElNLmSShnMF1a iN+TOedlhchXLB7S79VZB2lr/NC6KG0yTKhD9N2zdMIhkOq2j6qlwlH/wjC+cae6OtcM Cg1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=tnW7scLNjEy1+83Ji/gI9Z51LMzzGDuvXsjQ7oxJByY=; b=ahmYri3XVIrBwvUIzQ+yHLZNkn1GXS5BZQpgYs4imGtdq4SF7Y+c5tADMJzgDUp7ib s6KvVilpAjo9mSk2EHuLgfeTgnpChdclTYO2U4MCzH0Qly6k7RymS6Y2BcnLLuasrkrs JdoYKr6AcPDKslbJq8xkmJIYwjXEER7iHN2QrDPlB/cIVCaWUOx4veBmePHAKjcPT0TK MJ9q2pg7r7xTn2MKirvbfh02aujDOiKskS7YPq+7yyskLpl8mjVykf6UWfmEnSL2kkaH sQhbFRQ7P0zVM7aKs+pY56+ST/HMYEfZI3nB4DH75yT7lhIlv09p1xmktlCY8kIY2OfX SpLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n1ZnoC3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si9948121edp.87.2020.05.13.06.14.49; Wed, 13 May 2020 06:15:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n1ZnoC3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2387476AbgEMNKn (ORCPT + 99 others); Wed, 13 May 2020 09:10:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726034AbgEMNKl (ORCPT ); Wed, 13 May 2020 09:10:41 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7909C061A0C for ; Wed, 13 May 2020 06:10:40 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id u15so17735865ljd.3 for ; Wed, 13 May 2020 06:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tnW7scLNjEy1+83Ji/gI9Z51LMzzGDuvXsjQ7oxJByY=; b=n1ZnoC3vZqhM3FzrFaAmzTOkeYAWUZSABvdCTqNV8QKysKgfumpOoF/X2OpzaJBj8I klHWWyxlIEd8ZgSEvnQAx+tWkdV/Y1rnfupyvCoYR1lAe3F+jYlJWQRHrqCT2SOGPADY UjUpAhl4NRo1ne6f/LS3Bk4Q3tSkrP1cAUpfNZQvpIypjo0UJKAtED9TkAogmwI0axj/ QBIdYUqXi0ecOsfNsUO3MWJKY/0MBXZ4/cmO5Xz3Y1L10lYF6OMq7zaUQ1GDqGEiVjXZ q0bEjtJuVvlsn5LwOm6ZDz+zTDx8u/NrD5UNnjl6oKRoevOVYD2I8jHHjy9fp2f8G7oO HTPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tnW7scLNjEy1+83Ji/gI9Z51LMzzGDuvXsjQ7oxJByY=; b=VpPtabp/BJczZ9w66x2PKmHKAKoRCNNVH9w1SBhVZJYJdK60Bj0QyZGjjLhYM+xu7m WHMPoJvGK7sQ2yf2rqpKOM6b07kHHa6QIN1ny3k/24Nba19a+sq15Dwhh+Lzu89DtzNS rmZYgSvZZaguaZBoLK+6/QqCR6CTk81+ZFaiimiTalnd3quDoQLzbjSJGyRwzoUtQMrs jq713BlUrP/uaEvfYJ8TajKJf883NCVb/gGra0jXxCfIh3p5XTH8slgVRUz0cZnT7T9p Ak8ekOORX+H6sIjt9LJ0AbgU9nC7j0bqJhsdUBuhzxplJ62I4f0aGUgxReySVYGBlZQ9 ySdQ== X-Gm-Message-State: AOAM530MQt8BDiWrc0h04TP7vHbIM778sCTjD+UzlYBbRmHI9eguFM7F OmBFN6+ur/1iidr0WPabGkwk1BbCE784Cbs1WLcadQ== X-Received: by 2002:a2e:87d0:: with SMTP id v16mr16409300ljj.137.1589375439209; Wed, 13 May 2020 06:10:39 -0700 (PDT) MIME-Version: 1.0 References: <20200513123335.28122-1-vincent.guittot@linaro.org> <20200513124540.GB12425@lorien.usersys.redhat.com> In-Reply-To: <20200513124540.GB12425@lorien.usersys.redhat.com> From: Vincent Guittot Date: Wed, 13 May 2020 15:10:28 +0200 Message-ID: Subject: Re: [PATCH v2] sched/fair: enqueue_task_fair optimization To: Phil Auld Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , linux-kernel , Tao Zhou , Pavan Kondeti Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 May 2020 at 14:45, Phil Auld wrote: > > Hi Vincent, > > On Wed, May 13, 2020 at 02:33:35PM +0200 Vincent Guittot wrote: > > enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is > > throttled which means that se can't be NULL and we can skip the test. > > > > s/be NULL/be non-NULL/ > > I think. This sentence refers to the move of enqueue_throttle and the fact that se can't be null when goto enqueue_throttle and we can jump directly after the if statement, which is now removed in v2 because se is always NULL if we don't use goto enqueue_throttle. I haven't change the commit message for the remove of if statement > > It's more like if it doesn't jump to the label then se must be NULL for > the loop to terminate. The final loop is a NOP if se is NULL. The check > wasn't protecting that. > > Otherwise still > > > Reviewed-by: Phil Auld > > Cheers, > Phil > > > > Signed-off-by: Vincent Guittot > > --- > > > > v2 changes: > > - Remove useless if statement > > > > kernel/sched/fair.c | 39 ++++++++++++++++++++------------------- > > 1 file changed, 20 insertions(+), 19 deletions(-) > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > index a0c690d57430..b51b12d63c39 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) > > list_add_leaf_cfs_rq(cfs_rq); > > } > > > > -enqueue_throttle: > > - if (!se) { > > - add_nr_running(rq, 1); > > - /* > > - * Since new tasks are assigned an initial util_avg equal to > > - * half of the spare capacity of their CPU, tiny tasks have the > > - * ability to cross the overutilized threshold, which will > > - * result in the load balancer ruining all the task placement > > - * done by EAS. As a way to mitigate that effect, do not account > > - * for the first enqueue operation of new tasks during the > > - * overutilized flag detection. > > - * > > - * A better way of solving this problem would be to wait for > > - * the PELT signals of tasks to converge before taking them > > - * into account, but that is not straightforward to implement, > > - * and the following generally works well enough in practice. > > - */ > > - if (flags & ENQUEUE_WAKEUP) > > - update_overutilized_status(rq); > > + /* At this point se is NULL and we are at root level*/ > > + add_nr_running(rq, 1); > > + > > + /* > > + * Since new tasks are assigned an initial util_avg equal to > > + * half of the spare capacity of their CPU, tiny tasks have the > > + * ability to cross the overutilized threshold, which will > > + * result in the load balancer ruining all the task placement > > + * done by EAS. As a way to mitigate that effect, do not account > > + * for the first enqueue operation of new tasks during the > > + * overutilized flag detection. > > + * > > + * A better way of solving this problem would be to wait for > > + * the PELT signals of tasks to converge before taking them > > + * into account, but that is not straightforward to implement, > > + * and the following generally works well enough in practice. > > + */ > > + if (flags & ENQUEUE_WAKEUP) > > + update_overutilized_status(rq); > > > > } > > > > +enqueue_throttle: > > if (cfs_bandwidth_used()) { > > /* > > * When bandwidth control is enabled; the cfs_rq_throttled() > > -- > > 2.17.1 > > > > -- >