Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp521133ybk; Wed, 13 May 2020 06:19:06 -0700 (PDT) X-Google-Smtp-Source: APiQypIhHpsbz+mqqSaVm6YOAooc5nE4R5TrWd0dREFqqFr17cp8UtxNyAxW6qUn7aRKj1G8dG/i X-Received: by 2002:a05:6402:b99:: with SMTP id cf25mr22070518edb.372.1589375946292; Wed, 13 May 2020 06:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589375946; cv=none; d=google.com; s=arc-20160816; b=hKFTPUx16UOslsib4b3xG3IgX+82z7STsrVR3h3+E6yvSMXX+gOF4P1Ri2pqhnGyk0 7MduZauRenmuAOwjMzHUMpTq6GYKtwWIenukcBXce8F89Hpj5er2CbwGxaYFO14XSzHR IUnQmFI0DyOSh8ahtOyk6mtxIDpf8klG+RAtFPg7aG9AlikSeBGIxuQWNvXyO6R9H2s0 31ziXpCWuZrgj67x3PrGxVTMqRjgOVJsek3AVCpFjsJOJMj2alQR7YosxnMLJ2eQAjOh oNagUii6gJ0DysOjkgibQbFp9l/KRcfHlDudos7AVoiGbDphZIke3cn9b6aobymUm0Qt Re1Q== 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=u3XslSA1/HmduXd9FQLdTYpbuOaEzN1IUj288Lu/Wdo=; b=eu3ytw0e+sUe4ipFUI1LStfoL3RctXVR2aCY4+TNqYaj+BIx/+3Z/NSXKsdrGdzfAZ T5f+LSyGPIvrkG1nu0SmMkyBq2fEZ+93p1c1EO0FaCV+5ai6OpLP6kRlJ1W2NolKPXXw PePrc5kYAPKMsMrSTIeZpGo7UxMnevoxUCDtq6l8qiXppjMJiEzzsCqQWUfNyEWgGP8x dKfG10nAvyvABYpRUxVrprAw9t7LU+XC/BVUSpBaGJ1HT9+wL6wRO1o9HMHYDAnRdeb0 Br1sodE1aZmEt34ZbMRQxXKM+BIm+aqYVLWRB3dkOd04O8dKQp0d7ATXe6k6RphHSkFi ItIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ki21gHxM; 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 h5si3042317eji.230.2020.05.13.06.18.41; Wed, 13 May 2020 06:19:06 -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=Ki21gHxM; 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 S1728659AbgEMNQK (ORCPT + 99 others); Wed, 13 May 2020 09:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbgEMNQJ (ORCPT ); Wed, 13 May 2020 09:16:09 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AF4AC061A0C for ; Wed, 13 May 2020 06:16:07 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id d21so10035540ljg.9 for ; Wed, 13 May 2020 06:16:07 -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=u3XslSA1/HmduXd9FQLdTYpbuOaEzN1IUj288Lu/Wdo=; b=Ki21gHxMSPIOXhJcPzwdt/QMk6sbI/zUtmnsLN/DmLIBZ7NEnI4x7N3DgI0Nig2Cm3 /IUTQMxDCFWY2toidoe8NtWpqFLRatqkoKNzGAnOg3f/b6fKM3A4iDDmgFvZz2sLD9nG mYobdMJXON1iX+qSZMHPQHzIuDMzAruOCQB20ue0axdlLya0gx8xmYaLjosNXXQhxpvB vu8jhEtky+iTPXqJNI5TyIlcDy3EPCgSd4gk3ag57ZNg9pRz//TLUZN7GPrfxABQWpvm 4YjmRIv3qSRyFBquzx+ryIAiLYMzmutdTScly5nUBML+jcmVSz0FQjmJoaHoAZAZNYNe Te2Q== 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=u3XslSA1/HmduXd9FQLdTYpbuOaEzN1IUj288Lu/Wdo=; b=AV8XfVyb9EwekvYAl7gxyLmAUDccGNbR221EoZvdU93CrKlADu/cYw5cBhFNghdgDx GufhaEsDxp/cUzrw/t0nB+pMaDlsHzlRCA5MEfhZizGpwYNavDSeKNUuEB3vY2mcQYwv cZiBZS6HYYcC7UmlH8S+keixBysKYGkaSad41Jib0A4aJ3zvVs2AZbfyA0d35Y6SRvz+ Km7uDU+F9EoVA2ohxeTKkK2qrwXLsiwTVhLVTkUW7Kx2WvD77P5y78k2f/WcJbO1IyiL QLtWb9mpYxk2+SYd2cSwmSJO02VPHp/CrmG5Bf1qnHPpcyS9jboJzkPV+dbBKyHyBSTV HvbQ== X-Gm-Message-State: AOAM530BPudv7vF73535Cd+Oxlc/GfTjKM2/1FFSRXyhPUzXJ1eolb/I bg+I+de7HOeE20uLLc2wqyh5pLReCcVaE4pRwE3jQg== X-Received: by 2002:a2e:9e43:: with SMTP id g3mr17927751ljk.4.1589375765684; Wed, 13 May 2020 06:16:05 -0700 (PDT) MIME-Version: 1.0 References: <20200513123335.28122-1-vincent.guittot@linaro.org> <20200513124540.GB12425@lorien.usersys.redhat.com> <20200513131337.GF12425@lorien.usersys.redhat.com> In-Reply-To: <20200513131337.GF12425@lorien.usersys.redhat.com> From: Vincent Guittot Date: Wed, 13 May 2020 15:15:53 +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 15:13, Phil Auld wrote: > > On Wed, May 13, 2020 at 03:10:28PM +0200 Vincent Guittot wrote: > > 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 > > > > Fair enough, it just seems backwards from the intent of the patch now. > > There is also an extra } after the update_overutilized_status. don't know what I did but it's crap. sorry about that Let me prepare a v3 > > > Cheers, > Phil > > > > > > > > > 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 > > > > > > > > > > -- > > > > > > > -- >