Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4962660ybl; Mon, 26 Aug 2019 19:48:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhZchtKVX9I0Xd8PQNagBI6pGIvSoTeGnB6KWCy8U9r9LURxapLPR0kY9laYgd+cwHwGEQ X-Received: by 2002:a17:902:6b81:: with SMTP id p1mr21987779plk.91.1566874088892; Mon, 26 Aug 2019 19:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566874088; cv=none; d=google.com; s=arc-20160816; b=H6wk1KmvHPn8BSXZXRHIJYqaVW9teDsi5VFv7REZ7g6TSCUaHI4BroAp0sohGe6hsB I0zkjE+gBZpbv6IRfQVMfjiNNJ7NwIfFI6Mc47eATz/ePYWPl0JMp8HpUwXstPDK0BI9 HCPB8ElSTuPu4WSfmSCg2OMyYiKj/GJtPC/Wc1dLf9m1b6HeyLjdfXB5WXqbNAvZgJbq zEsu0UDCriIMFImR6+g5WQvTsPAU5nqUm1cil025KAbvj8fXZY/Nu3exmUgeh+tWhPfT zDEZy32xOo2giR7tf5AbWbucADx3jPACUXV8A7hZW1yjM+ezgVqIycfCdLUR2J/MtBOV IWlQ== 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=gtORyycbq2++4+xH7lXu7U4B61twYoP45KgH+ARaPNU=; b=Xax7XRGVTUUaQ82tD5iDsxnU7ofnWHXJvEVaEX7UA0AMoI/n4gvp0KTFQ1Rt5LmZ3J +ioW1PGNH8iC9BEFPqbEjmixGS1m93q51MPXNukussRKVmXURJ1CZFIqu9d1lmHHBLCl 4LPOpF9R5byzKWwn3qq7J1JXE9pQdJh+I5rAPtcs3KyZjWd5Qj5sKrJlnAWnw81Ikno+ WI1cVsPRktZSmmFq8gbqazRFBixcOlGi8/SeTdncREQeYeNayFAKlC6wVj2Kc/EdP+eu b10nuk5TjsyYlnuRDW3NwGCQ1wZgATNc4vKAj1ZtfLnwBx1ta4f0HCG5tTuK15RuhXHl zA3g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si10505638pgr.237.2019.08.26.19.47.53; Mon, 26 Aug 2019 19:48:08 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728851AbfH0CpO (ORCPT + 99 others); Mon, 26 Aug 2019 22:45:14 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:40583 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727887AbfH0CpO (ORCPT ); Mon, 26 Aug 2019 22:45:14 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R441e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=liangyan.peng@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0TaZLKac_1566873900; Received: from LiangyandeMacBook-Pro.local(mailfrom:liangyan.peng@linux.alibaba.com fp:SMTPD_---0TaZLKac_1566873900) by smtp.aliyun-inc.com(127.0.0.1); Tue, 27 Aug 2019 10:45:00 +0800 Subject: Re: [PATCH] sched/fair: don't assign runtime for throttled cfs_rq To: bsegall@google.com, Valentin Schneider 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> <942ae15c-ffa5-74da-208b-7e82df917e16@arm.com> From: Liangyan Message-ID: <5cfadb62-10b7-d16b-7f30-f3573bb04844@linux.alibaba.com> Date: Tue, 27 Aug 2019 10:45:00 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/8/27 上午1:38, bsegall@google.com wrote: > Valentin Schneider writes: > >> 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. > > I'm not sure about stable policy in general, but it seems reasonable. > The WARN_ON might want to be WARN_ON_ONCE, and it seems fine to have it > or not. Thanks Ben and Valentin for all of the comments. Per Xunlei's suggestion, I used SCHED_WARN_ON instead in v3. Regarding whether cc stable, I'm also not sure. > >> >> >> Other than that, >> >> Reviewed-by: Valentin Schneider >> >> [...]