Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1272491ybl; Fri, 23 Aug 2019 16:39:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXw+Vywg0trc/zZMGm+XmqWCe8/HBT8bWj5wW3wCT1kzQGpfKXn9hwHfVyIW4ckiKjdoRu X-Received: by 2002:a63:cb4b:: with SMTP id m11mr6229811pgi.49.1566603587014; Fri, 23 Aug 2019 16:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566603587; cv=none; d=google.com; s=arc-20160816; b=Dx2DoKKCjjD61ki2rkJRf6KVkM5Tb1OmAuWv8wMfV65w7GeM/h2wc4lFcqLJgYedO+ c5KnYX1ztysJmu1klt8zy9fBz3+uUhs9CwoGKJqgTVDXzDUiWMMPUJBE86hF0Mtu6ERk hYoPty4Jo79KHabbngDj66q/ejDIafi/WWdMrlcf59BkukmU71S8cTg0t6D2j0uvyUKS JKt/yOiFnmOURw8s7DRe3BpUJLozDCf3vem4YxkaXgUvv/IB+qVH5i+9PSz8qS9ihfrq vzl06OwSAKYk3VbsMX2u53YJ/LgaAkUHIaPo2zPcO3EC6zzByo72oNjLkQJi+DudzI1b df9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=I/kD3AdOT/YNW8k7cuptqwGFGEWTfMKAvukutXm7+Jw=; b=lGvoqPsz2xBfdf9fw0NNJhW4juoaOtPmEayP25qMkLC3WLdryQ2yoepjnQuQHUSo3W Z72XEtRleTIPEdykd7QLjFOOeaZyDUeA4qAhE1Qr9xJbJFMkLUdH1SmkDDvAx/EUvW66 QRKP9Ujimjc5KioPaNuh1bj6vBaetnbf+qPBAd1xN/tL2Mv51PiLKFj7o67SNTcSTSzD xTQz6mtXAiyPbExMn3/dleevhkeoeu5PXlRN9f/6cy2qoei7KH/W6DTzKNJAhU4ylT/R kUG0iXwURrkOcqbHYPfM86cU59Wid+xICYGDyZM3qnwT31LjescPrb4kkzlTRm1Ytz+n Hvag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 123si4101155pfy.61.2019.08.23.16.39.31; Fri, 23 Aug 2019 16:39:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727010AbfHWXTM (ORCPT + 99 others); Fri, 23 Aug 2019 19:19:12 -0400 Received: from foss.arm.com ([217.140.110.172]:39548 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfHWXTM (ORCPT ); Fri, 23 Aug 2019 19:19:12 -0400 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 7F35328; Fri, 23 Aug 2019 16:19:11 -0700 (PDT) Received: from [10.0.2.15] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 665A43F246; Fri, 23 Aug 2019 16:19:10 -0700 (PDT) Subject: Re: [PATCH] sched/fair: don't assign runtime for throttled cfs_rq To: bsegall@google.com, Liangyan Cc: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, shanpeic@linux.alibaba.com, xlpang@linux.alibaba.com References: <20190814180021.165389-1-liangyan.peng@linux.alibaba.com> From: Valentin Schneider Message-ID: <942ae15c-ffa5-74da-208b-7e82df917e16@arm.com> Date: Sat, 24 Aug 2019 00:19:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/08/2019 21:00, bsegall@google.com wrote: [...] > Could you mention in the message that this a throttled cfs_rq can have > account_cfs_rq_runtime called on it because it is throttled before > idle_balance, and the idle_balance calls update_rq_clock to add time > that is accounted to the task. > Mayhaps even a comment for the extra condition. > I think this solution is less risky than unthrottling > in this area, so other than that: > > Reviewed-by: Ben Segall > If you don't mind squashing this in: -----8<----- diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b1d9cec9b1ed..b47b0bcf56bc 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4630,6 +4630,10 @@ static u64 distribute_cfs_runtime(struct cfs_bandwidth *cfs_b, u64 remaining) if (!cfs_rq_throttled(cfs_rq)) goto next; + /* By the above check, this should never be true */ + WARN_ON(cfs_rq->runtime_remaining > 0); + + /* Pick the minimum amount to return to a positive quota state */ runtime = -cfs_rq->runtime_remaining + 1; if (runtime > remaining) runtime = remaining; ----->8----- I'm not adamant about the extra comment, but the WARN_ON would be nice IMO. @Ben, do you reckon we want to strap Cc: Fixes: ec12cb7f31e2 ("sched: Accumulate per-cfs_rq cpu usage and charge against bandwidth") to the thing? AFAICT the pick_next_task_fair() + idle_balance() dance you described should still be possible on that commit. Other than that, Reviewed-by: Valentin Schneider [...]