Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp645100pxb; Wed, 11 Nov 2020 12:29:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxHCv91qdmVL9J7T19UgjVhlgzBnL+5e/m5xoaygpg6yZQTKv2EH0PZR+n8frNILoUrS7c X-Received: by 2002:a17:906:a250:: with SMTP id bi16mr25594428ejb.265.1605126569605; Wed, 11 Nov 2020 12:29:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605126569; cv=none; d=google.com; s=arc-20160816; b=o1deS86t5iegGkR6pG399PicHHvGJ5VVVKj5uiV52gA5gAVJorqn4zQBl6gPPnuO6f yy4VDFbTj2zahjiRZhiAOY4Za7GRU3aq/4aWqGXgN+JMDqaV/UJ/oKY+68yrF96wgHHw NR3D3RkczDKNtWK3/9YCd/Zf+VCLPUzB3SiQrlsvaKEXBz/w4Edb1TGGQP+7kdSw3GXn 3+TNjZ4+QMldrJV9Hreo+G3aUVAimyKFwJh8MI0BJtxfh799yB3pdSzm1wY0N/pXEh3k UanWNOyvcylcDkFTOxRu03NbyrCvZ6d4qBtdzsYkNBf+PgVkboZeEBW0uS/iFd/+hIPp PALA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=HFbcfghrXl/4oELlWns8aLXCM0wCJzjklzVvbre9mS0=; b=RJcMQwVWJgjR/7MHPaZ3ZUUBGLXNnWCvu1OkYlbUGbIGKh3yBfuS6rwfzWK2jEQRDo ZsdXwp9nNLQhVcI120SmVm9dwMqIn1K2Ae1oK2cD0TW9sMsmnKO9/6Ass8Cz1Kn22qCg 5DFme/8WmWtvg1+QGxP36yvk1tGwK6nd+szX0GTVTJi/LDiQu1SXWTUZ1oJsePnFNHyg zHtGtQSUug9c4Q0PHw2eOv/zTwP17wl09OObGtm1unDSdhngcRf0bP3/9IBngden6ATt gEctFAy8+eW9oO5g/mKJIIUt8NZjTWQJxwVjacNjXhZ3dowzB9pgVW4R6sCG/aTlCe8k 3dtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=i7xHcbVH; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e13si2263791edj.548.2020.11.11.12.29.05; Wed, 11 Nov 2020 12:29:29 -0800 (PST) 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=@google.com header.s=20161025 header.b=i7xHcbVH; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725996AbgKKU1M (ORCPT + 99 others); Wed, 11 Nov 2020 15:27:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725860AbgKKU1M (ORCPT ); Wed, 11 Nov 2020 15:27:12 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20730C0613D1 for ; Wed, 11 Nov 2020 12:27:12 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id c66so2370710pfa.4 for ; Wed, 11 Nov 2020 12:27:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=HFbcfghrXl/4oELlWns8aLXCM0wCJzjklzVvbre9mS0=; b=i7xHcbVHlMh+l+Mh/dgtYoaVdDJQysJVYSWkJD6/29rhevjco7bnVs16js7zNcTtqJ IhZF3E4neHZ3WXmN62faoMbEv05Ai/RrLaFn+l0QR6VEbiiTxckYGurS7acTcoI0c5Pd 0+SR/j1xtr5HJ2T76ByDCBDMn6PrL4JewJRGjJI6poLrLhjszbLoMyAd7tVefl4aAr/3 0G+o21tgTKor6E7Gd45jZqSKsCd99kIsMTM2u1MsZLGcvkj+MYUXTL66QCHZbficuXlN EjCTEoKZwFn2BP7Hte1hohXxmoZSzIPIQ7LJxrSe7fLQR8u6Cdm6enyzIySPJtpnFem/ 4KYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=HFbcfghrXl/4oELlWns8aLXCM0wCJzjklzVvbre9mS0=; b=mkr7uuFP6MhsvQFjwyOiYorLcUY/CK/hv7a87PDh5bLou0f93EgnbBy5z+WT2hC42m 8OXCJm8sbuovf9vDlMR+dBme7fZzHxWUDl1CLVoZBuO+RRw+l/Aa/ekskIhOYkTMQpYW QF+cequVs7tgNFgVU5YADWbESgQlmaQgiWTvDW+qlr2Aa/jEIrPXStrmgWI47m77/1YB yXKEtAq0JLjq4R04IXIoCLmJ1znukFo0M2ZMo8TvEggqFqw8oWKq3FeBk3YPINFuEDwu A4xMM9gb50/lW4XOf3+VGMDQF4UHQhI6rxFxbxaFCD5/ZtZvC0xznbO8J9XRtfXGuxYw 9nrA== X-Gm-Message-State: AOAM533frtcZQmeONHwW4/Lpf3UNc8JGucXiYaaeZ+A3wKAHXswheVCC narQES1HgAjbe0Bw7n4PVH1NLBA+keC0ow== X-Received: by 2002:a62:86c9:0:b029:18b:e117:3cb7 with SMTP id x192-20020a6286c90000b029018be1173cb7mr19513297pfd.62.1605126431151; Wed, 11 Nov 2020 12:27:11 -0800 (PST) Received: from bsegall-glaptop.localhost (c-73-71-82-80.hsd1.ca.comcast.net. [73.71.82.80]) by smtp.gmail.com with ESMTPSA id u197sm3714329pfc.127.2020.11.11.12.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 12:27:10 -0800 (PST) From: Benjamin Segall To: Peng Wang Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bristot@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched/fair: Reorder throttle_cfs_rq() path References: Date: Wed, 11 Nov 2020 12:27:07 -0800 In-Reply-To: (Peng Wang's message of "Tue, 10 Nov 2020 10:11:59 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peng Wang writes: > As commit 39f23ce07b93 ("sched/fair: Fix unthrottle_cfs_rq() for > leaf_cfs_rq list") does in unthrottle_cfs_rq(), throttle_cfs_rq() > can also use the same pattern as dequeue_task_fair(). > > There is no functional changes. It's generally a bit more hassle and less clear, but the parallel to dequeue_task_fair probably makes up for it. Reviewed-by: Ben Segall > > Signed-off-by: Peng Wang > --- > kernel/sched/fair.c | 34 +++++++++++++++++++++++----------- > 1 file changed, 23 insertions(+), 11 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 290f9e3..27a69af 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -4779,25 +4779,37 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) > struct cfs_rq *qcfs_rq = cfs_rq_of(se); > /* throttled entity or throttle-on-deactivate */ > if (!se->on_rq) > - break; > + goto done; > > - if (dequeue) { > - dequeue_entity(qcfs_rq, se, DEQUEUE_SLEEP); > - } else { > - update_load_avg(qcfs_rq, se, 0); > - se_update_runnable(se); > - } > + dequeue_entity(qcfs_rq, se, DEQUEUE_SLEEP); > > qcfs_rq->h_nr_running -= task_delta; > qcfs_rq->idle_h_nr_running -= idle_task_delta; > > - if (qcfs_rq->load.weight) > - dequeue = 0; > + if (qcfs_rq->load.weight) { > + /* Avoid re-evaluating load for this entity: */ > + se = parent_entity(se); > + break; > + } > } > > - if (!se) > - sub_nr_running(rq, task_delta); > + for_each_sched_entity(se) { > + struct cfs_rq *qcfs_rq = cfs_rq_of(se); > + /* throttled entity or throttle-on-deactivate */ > + if (!se->on_rq) > + goto done; > + > + update_load_avg(qcfs_rq, se, 0); > + se_update_runnable(se); > > + qcfs_rq->h_nr_running -= task_delta; > + qcfs_rq->idle_h_nr_running -= idle_task_delta; > + } > + > + /* At this point se is NULL and we are at root level*/ > + sub_nr_running(rq, task_delta); > + > +done: > /* > * Note: distribution will already see us throttled via the > * throttled-list. rq->lock protects completion.